Search the Community
Showing results for tags 'phpfunctions'.
-
I have a query which is looking for events on any given month of the year. It looks as follows... $events = array();mysql_select_db($database_dbconnect, $dbconnect);$query = "SELECT calsect, title,idcalendar, DATE_FORMAT(event_date,'%Y-%m-%d') AS event_date FROM calendar WHERE event_date LIKE '$year-$month%'";$result = mysql_query($query, $dbconnect) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) {$events[$row['event_date']][] = $row;} I then have a function which calls a calendar. As the function is looping through days of the week it also checks on each day if there is any event. If there is it prints it. If not it moves on to the next day. It actually works great. I can echo the title, idcalendar and the event_date but I can not the calsect field. /* print "blank" days until the first of the current week */for($x = 0; $x < $running_day; $x++):$calendar.= '<td class="calendar-day-np"> </td>';$days_in_this_week++;endfor; /* keep going with days.... */for($list_day = 1; $list_day <= $days_in_month; $list_day++):$calendar.= '<td class="calendar-day"><div style="position:relative;height:100px;">';/* add in the day number */$calendar.= '<div class="day-number">'.$list_day.'</div>'; $event_day = sprintf('%04d-%02d-%02d', $year, $month, $list_day); /* list the events */if(isset($events[$event_day])) {foreach($events[$event_day] as $event) { //My title appears but the $event['calsect'] is not!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $calendar.='<div class="' .$event['calsect']. '">' .$event['title']. '</div>';}}else {$calendar.= str_repeat('<p> </p>',2);} If I view source on an event I get this. <div class="">Test Event</div> where class should equal $event['calsect'] (or blue in this case) .