For Loop going too long
| From: | David Johansen | Date: | Sat, 30 Mar 2002 23:40:50 +0000 |
| Subject: | For Loop going too long | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-90818@lists.php.net to get a copy of this message | ||
I have a question about something weird that I've noticed Here's some code
that I have that loads up
$sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
$dayofmonth";
$result = mysql_query($sql, $dbh);
$day = mysql_fetch_array($result);
for ($i=0; $i<sizeof($day); $i++)
echo "I: $i Result: $day[$i]<br>";
When I do this it prints out 2 times the number of columns that I actually
have plus 1. All of the ones past the actual number of columns are just
empty, but is there something that I'm doing wrong? Thanks,
Dave