I'm trying to loop through an array of fetched rows from a database. Each time through the loop's looking for a specific date if it finds it, it prints the event. If a event is not found for the date it's supposed to print another pattern (the &lattice), add a days worth of seconds to the search date and do it again. Right now the search date ($current) will not update.
Here's what I have:
Code: Select all
$events_res=array();
$current = time();
while($events_row = mysql_fetch_assoc($events)){
$events_res[]=$events_row;
}
for($i=0; $i<7; $i++){
$lattice = TRUE;
for($i=0; $i<count($events_res); $i++){
$current_f = date("n d",$current);
$compare = $events_res[$i][month]." ".$events_res[$i][day];
if ($current_f == $compare) {
$evt_date = mktime(0,0,0,$events_res[$i][month],$events_res[$i][day],0);
echo "
<div class=\"event\">
<div id=\"day\">".strtoupper(date("M d",$evt_date))."</div>
<a href=\"dj.html\">".$events_res[$i][name]."</a>
<p>".$events_res[$i][desc]."</p>
</div>";
$lattice = FALSE;
}
if($lattice&&$i=count($events_res)-1){
echo "<div class=\"no_event\">
<div id=\"day\">day</div>
</div>";
}
}
$current+=86400;
}