note 114770 added to function.sqlsrv-fetch-array
| From: | Anonymous | Date: | Thu, 03 Apr 2014 19:15:18 +0000 |
| Subject: | note 114770 added to function.sqlsrv-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199115@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 72.52.91.14
Probable Submitter: 96.233.109.34
----
Manual Page -- http://php.net/manual/en/function.sqlsrv-fetch-array.php
Edit -- https://master.php.net/note/edit/114770
Del: integrated -- https://master.php.net/note/delete/114770/integrated
Del: useless -- https://master.php.net/note/delete/114770/useless
Del: bad code -- https://master.php.net/note/delete/114770/bad+code
Del: spam -- https://master.php.net/note/delete/114770/spam
Del: non-english -- https://master.php.net/note/delete/114770/non-english
Del: in docs -- https://master.php.net/note/delete/114770/in+docs
Del: other reasons-- https://master.php.net/note/delete/114770
Reject -- https://master.php.net/note/reject/114770
Search -- https://master.php.net/manage/user-notes.php