dachshund Posted May 15, 2008 Share Posted May 15, 2008 Hi, I currently have this coding <?php $sql="SELECT * FROM events ORDER BY id DESC LIMIT 10"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <table width="100%" border="0" align="center" cellpadding="5" class="bottomborder"> <tr> <td align="left" valign="top" bgcolor="#FFFFFF" class="condensedeventcontent" rowspan="2" width="110" height="75"> <a href="http://www.onthehuh.com/events/view_event.php?id=<? echo $rows['id']; ?>"><img src="<? echo $rows['smallimage']; ?>" border="0" /></a> </td> <td align="left" valign="top" bgcolor="#FFFFFF" class="condensedeventtitle"> <a href="http://www.onthehuh.com/events/view_event.php?id=<? echo $rows['id']; ?>"><? echo $rows['title']; ?></a> </td> </tr> <tr> <td align="left" valign="bottom" bgcolor="#FFFFFF" colspan="2" class="condensedeventcontent"><? echo $rows['venue']; ?> </td> </tr> <?php } mysql_close(); ?> </table> Which posts all events listed, with the newest listed first. I want to change it so that the events are only listed if they are currently on, so i need a code which tells the event only to be listed if todays date is inbetween the startdate and enddate. Any ideas? Thanks Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 15, 2008 Share Posted May 15, 2008 something like: $today = date('Y-m-d'); $sql="SELECT * FROM events WHERE startdate <= '$today' AND enddate >= '$today' ORDER BY id DESC LIMIT 10"; Quote Link to comment Share on other sites More sharing options...
dachshund Posted May 15, 2008 Author Share Posted May 15, 2008 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.