NYCPHP Meetup

NYPHP.org

problem with count() function

Peter Lehrer pl at eskimo.com
Fri Jun 6 23:00:13 EDT 2003


I noticed when using count() on an array fetched from a mysql db, it returns
twice the amount of elements in the array.

For instance:
<?
$stmt = "SELECT element1,element2,element3,element4,element5 FROM $table";
$sth = mysql_query($stmt, $dbh);

$row = mysql_fetch_array($sth);

$Count = count($count);
?>

$Count will equal 10 instead of 5. Has anyone else noticed this behaviour?

--peter




More information about the talk mailing list