SQL call for future Events
Posted: Thu Oct 29, 2009 2:49 pm
I am designing a dynamic webpage that uses a SQL DB to call events... It works in the fact that it calls and displays all the events. Now I am trying to filter it so it only shows the events that are in the future. I have put a PHP clock on the site and can call the current time/date in variable and put it where ever. My thought was to then use an IF statement that would compare event.eventEnd (field of ending time of event in YYYY-MM-DD 00:00:00 format) to $gDate (current Time/Date in UNIX Seconds format). I also selected the event.eventEnd from the DB in UNIX_TIMESTAMP so they would be in the same format. I can display both numbers on the page with the repeating do {} loop but I can't figure out where and how to put the IF statement...
the site as is is upon a test site and can be viewed at http://www.osheaslouisville.net/test
the site as is is upon a test site and can be viewed at http://www.osheaslouisville.net/test
Code: Select all
<?php do {
<p align="center" class="happeningsall">
<?php echo $gDate?><br />
<?php echo $row_rsToday['UNIX_TIMESTAMP(event.eventEnd)']?></p>
<p align="center">
<span class="happenings_location">
<a href="event_descriptions.php?eventID=<?php echo $row_rsToday['eventID']; ?>" target="_parent">
<?php echo $row_rsToday['locationName']; ?></a></span>
<a href="event_descriptions.php?eventID=<?php echo $row_rsToday['eventID']; ?>" target="_parent"><br />
<span class="happeningsall">
<?php echo $row_rsToday['eventName']; ?><br />
<?php echo date('D, m/d/Y',strtotime($row_rsToday['eventStart'])); ?></span></a>
<span class="happeningsall"></span><br /><br />
<img src="images/divider.jpg" width="82" height="6"/><br /></p>
<?php } while ($row_rsToday = mysql_fetch_assoc($rsToday)) ; ?>