[#2]
Anonymous [2014-04-03 19:15:16]
Note that while the docs say to avoid SQLSRV_FETCH_ASSOC when dealing with result sets where multiple fields have the same name, there are cases when this is perfectly valid to do.
Consider the following query:
SELECT * FROM a INNER JOIN b ON a.id = b.id
For any row, if you fetch NUMERIC you'll get a field for both a.id and b.id, which probably isn't very useful.
If you fetch ASSOC, you'll get one field for "id", and given that it's always the same in both tables (because your query insists it is so), you're not at risk of losing anything.
If you're generating output based on an unknown number of fields, the ASSOC behavior might be preferred.
|