php-general | 2001092
Date: 09/30/01
- Next message: Jack Dempsey: "RE: [PHP] looping through database results"
- Previous message: Perfumes2u.com: "[PHP] Gain with no pain"
- Next in thread: Jack Dempsey: "RE: [PHP] looping through database results"
- Reply: Jack Dempsey: "RE: [PHP] looping through database results"
- Reply: elists <email protected>: "Re: [PHP] looping through database results"
- Maybe reply: Karl Nelson: "Re: [PHP] looping through database results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm working on a basic calendar app in PHP, but I've hit a snag.
The events are stored in a MySQL database, and the goal is to have the
events displayed on the correct day on the calendar. The calendar is
generated through a couple of while() statements that loop through the weeks
and days. I'm having trouble getting the events from the database match up
with the correct days.
I think the problem is that I can only loop through the database results
once.
The code looks something like this (lots of extraneous stuff trimmed):
while ($day_of_week <= 6)
{
while ($event_row = mysql_fetch_array($events))
{
$event_day = $event_row["event_day"];
if ($event_day == $day)
{
$event_name = $event_row["event_name"];
print "$event_name\n";
}
}
}
Since it seems to only loop through the while ($event_row =
mysql_fetch_array($events)) statement once (instead of the 30 times I want
it to loop through), I figure the issue is that after the one loop,
$event_row does indeed equal mysql_fetch_array($events). So I try to unset
the $event_row after the loop, but that didn't work. I even tried to make
$event_row into a variable variable name. Couldn't get that to work either.
I'm running PHP version 4.0.6, if that matters.
thanks,
Karl
(feel free to cc karlnelson <email protected>, as I'm on the digest)
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jack Dempsey: "RE: [PHP] looping through database results"
- Previous message: Perfumes2u.com: "[PHP] Gain with no pain"
- Next in thread: Jack Dempsey: "RE: [PHP] looping through database results"
- Reply: Jack Dempsey: "RE: [PHP] looping through database results"
- Reply: elists <email protected>: "Re: [PHP] looping through database results"
- Maybe reply: Karl Nelson: "Re: [PHP] looping through database results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

