note 111208 added to mysqli-result.fetch-array
| From: | Duncan | Date: | Fri, 25 Jan 2013 23:07:20 +0000 |
| Subject: | note 111208 added to mysqli-result.fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193394@lists.php.net to get a copy of this message | ||
Note that the array returned contains only strings.
E.g. when a MySQL field is an INT you may expect the field to be returned as an integer, however all
fields are simply returned as strings.
What this means: use double-equals not triple equals when comparing numbers.
<?php
print $array_from_mysqli_fetch_array['id'] == 1 ? "true" : "false"; //
true
print $array_from_mysqli_fetch_array['id'] === 1 ? "true" : "false";
// false
?>
----
Server IP: 103.6.212.224
Probable Submitter: 121.75.100.175
----
Manual Page -- http://php.net/manual/en/mysqli-result.fetch-array.php
Edit -- https://master.php.net/note/edit/111208
Del: integrated -- https://master.php.net/note/delete/111208/integrated
Del: useless -- https://master.php.net/note/delete/111208/useless
Del: bad code -- https://master.php.net/note/delete/111208/bad+code
Del: spam -- https://master.php.net/note/delete/111208/spam
Del: non-english -- https://master.php.net/note/delete/111208/non-english
Del: in docs -- https://master.php.net/note/delete/111208/in+docs
Del: other reasons-- https://master.php.net/note/delete/111208
Reject -- https://master.php.net/note/reject/111208
Search -- https://master.php.net/manage/user-notes.php