note 124798 added to pdostatement.fetch
| From: | paulf at quillandmouse dot com | Date: | Thu, 05 Mar 2020 14:12:25 +0000 |
| Subject: | note 124798 added to pdostatement.fetch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214291@lists.php.net to get a copy of this message | ||
A prior poster indicated that this function returns a NULL when there are no results. This is not
true. This function returns an empty array. fetchAll() returns the same.
Also, the documentation specifies what happens on "failure", but doesn't indicate
what constitutes a "failure". A "failure" could be where the function returns no
results; that is, the query "failed". However, a "failure" is apparently a
situation where the PDO error functions would reveal a "failure", as in illegal SQL
syntax, or a query on a table which doesn't exist, etc. An empty result is not a
"failure". Maybe that's obvious to everyone else, but it wasn't to me.
----
Server IP: 45.112.84.4
Probable Submitter: 38.142.137.34 (proxied: 2603:9000:d715:8900:5ca2:1160:6846:e26f)
----
Manual Page -- http://php.net/manual/en/pdostatement.fetch.php
Edit -- https://master.php.net/note/edit/124798
Del: integrated -- https://master.php.net/note/delete/124798/integrated
Del: useless -- https://master.php.net/note/delete/124798/useless
Del: bad code -- https://master.php.net/note/delete/124798/bad+code
Del: spam -- https://master.php.net/note/delete/124798/spam
Del: non-english -- https://master.php.net/note/delete/124798/non-english
Del: in docs -- https://master.php.net/note/delete/124798/in+docs
Del: other reasons-- https://master.php.net/note/delete/124798
Reject -- https://master.php.net/note/reject/124798
Search -- https://master.php.net/manage/user-notes.php