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 Link to comment https://forums.phpfreaks.com/topic/105833-solved-help-with-coding/ 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"; Link to comment https://forums.phpfreaks.com/topic/105833-solved-help-with-coding/#findComment-542445 Share on other sites More sharing options...
dachshund Posted May 15, 2008 Author Share Posted May 15, 2008 Thanks! Link to comment https://forums.phpfreaks.com/topic/105833-solved-help-with-coding/#findComment-542457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.