note 1065 modified in count by ronabop

From: Date: Wed, 04 Oct 2000 14:38:00 +0000
Subject: note 1065 modified in count by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-6019@lists.php.net to get a copy of this message
Be careful of recasting your variables, especially with database array returns: $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 http://www.php.net/manual/function.count.php

« previous php.notes (#6019) next »