$cond .= "exists(select * from `attends` where `eventNo` = `event`.`eventNo` and `memberID` = '{$USER}')"; } if ($type != 'past') { if ($cond != '') { $cond .= " and "; } $cond .= "`semester` = '{$SEMESTER}'"; } if ($cond != '') { $cond = "where {$cond}"; } $sql = "select `eventNo` from `event` {$cond} order by `callTime` desc"; $events = mysql_query($sql); if (!$events) { die(mysql_error()); } echo '<div class="block span5" id="events"><table class="table" id="eventsTable">'; if (mysql_num_rows($events) == 0) { echo "(No events yet this semester)"; } while ($row = mysql_fetch_array($events, MYSQL_ASSOC)) { $eventDetails = getEventDetails($row['eventNo']); echo '<tr class="event" id="' . $eventDetails['eventNo'] . '"> <td style="">' . labelArea($eventDetails['type']) . '</td> <td>' . $eventDetails['name'] . '</td> <td style="min-width: 8em">' . date("D, M d", strtotime($eventDetails["callTime"])) . '</td> <td style="">' . (strtotime($eventDetails['callTime']) > time() ? buttonArea($row['eventNo'], $eventDetails['type']) : '<span class="label label-inverse">This event is over</span>') . '</td> </tr>'; } echo '</table></div>'; echo '<div class="block span6" id="eventDetails"><p>Select an event</p></dev>';
if ($tCount > 0) { $t .= " or "; } $t .= "type='{$type}'"; $tCount++; } $sCount = 0; $s = ""; foreach ($semesters as $semester) { if ($sCount > 0) { $s .= " or "; } $s .= "semester='{$semester}'"; $sCount++; } $sql = "select * from event where ({$t}) AND ({$s}) order by callTime desc"; $events = mysql_query($sql); $html = '<div class="block span5" id="events"><table class="table" id="eventsTable">'; while ($row = mysql_fetch_array($events, MYSQL_ASSOC)) { $eventDetails = getEventDetails($row['eventNo']); $html = $html . ' <tr class="event" id="' . $eventDetails['eventNo'] . '"> <td>' . labelArea($eventDetails['type']) . '</td> <td>' . $eventDetails['name'] . '</td> <td>' . date("l, F d, Y", strtotime($eventDetails["callTime"])) . '</td> <td>' . (strtotime($eventDetails['callTime']) > time() ? buttonArea($row['eventNo'], $eventDetails['type']) : '<span class="label label-inverse">This event is over</span>') . '</td> </tr> '; } echo $html . '</table></div>'; eventExtras();
$semesters = explode('^', $_POST['semesters']); $tCount = 0; $t = ""; foreach ($types as $type) { if ($tCount > 0) { $t .= " or "; } $t .= "type='{$type}'"; $tCount++; } $sCount = 0; $s = ""; foreach ($semesters as $semester) { if ($sCount > 0) { $s .= " or "; } $s .= "semester='{$semester}'"; $sCount++; } $sql = "select * from event where ({$t}) AND ({$s}) order by callTime desc"; $events = mysql_query($sql); $html = ' <div id="events"> <table class="table" id="eventsTable">'; while ($row = mysql_fetch_array($events, MYSQL_ASSOC)) { $eventDetails = getEventDetails($row['eventNo']); $html = $html . "\n\t\t<tr id='" . $eventDetails['eventNo'] . "_row'>\n\t\t\t<td>" . labelArea($eventDetails['type']) . "</td>\n\t\t\t<td>" . $eventDetails['name'] . "</td>\n\t\t\t<td>" . date('D, M d, Y', strtotime($eventDetails['callTime'])) . "</td>\n\t\t\t<td><button type=\"button\" class=\"btn btn-danger btn-mini removeButton\" value=\"" . $eventDetails['name'] . "\" id=\"" . $row['eventNo'] . "\">Remove</button></td>\n\t\t</tr>"; } echo $html . ' </table> </div>';