note 1065 deleted from function.count by felipe
| From: | felipe@php.net | Date: | Sat, 29 Dec 2007 15:51:09 +0000 |
| Subject: | note 1065 deleted from function.count by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134110@lists.php.net to get a copy of this message | ||
Note Submitter: dmb27 at cornell dot edu
----
Be careful of recasting your variables, especially with database array returns:
<?php
$res = mysql_query("select * from blah") // a query that returns an empty set
$row = mysql_fetch_array($res); // get's 0 since there's no return
echo count($row); // echos 1 - since $row is not an array
echo $row[0]; // echos "", but casts $row as an array?
echo count($row); // echos 0 now
?>