array count() oddity
| From: | Guru Geek | Date: | Fri, 30 May 2003 21:15:05 +0000 |
| Subject: | array count() oddity | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149600@lists.php.net to get a copy of this message | ||
Hello,
I have a mysql statement listed below. The table contains about 100
rows of information. Only one row matches the $criteria. Can anyone
tell me why the count($myrow) is 8? Shouldn't it be 4 (id, vanNumber,
origin, destination)?
$criteria = "02-25-2003";
$result = mysql_query("SELECT id, vanNumber, origin, destination FROM
thisHereTable WHERE date='$criteria'");
$myrow = mysql_fetch_array($result);
And when I run the rest of the script, it prints out the results 8 times
instead of once....
for ($count=0; $count<count($myrow); $count++)
{
print "<p>".$myrow["vanNumber"];
print "<br>".$myrow["origin"]." to
".$myrow["destination"];
}
THANKS,
Roger