dmschenk Posted May 20, 2007 Share Posted May 20, 2007 I have a simple event list that I would like to improve upon but I'm not exactly sure how to go about. What I would like to do is when a date passes to yesterday I would like to stop displaying it in my events list. I would also prefer not to delete its existence but change the field "Online = 1" to "Online = 0" in the database. Is this something I can do or is there a better way? I'm open to any ideas. Here is my current sql statement: $sql = "SELECT MONTHNAME(Date), EventDesc, Date, EventLocation, Online FROM calendar WHERE Online = 1 ORDER BY Date"; Thanks Dave Link to comment https://forums.phpfreaks.com/topic/52218-solved-stop-past-dates/ Share on other sites More sharing options...
AndyB Posted May 20, 2007 Share Posted May 20, 2007 I'd suggest changing the query to WHERE Date < '$today'. Today is easily determined by date() function $today = date("Y-m-d"). I do hope that Date in your database is a rational date where comparisons are possible. Link to comment https://forums.phpfreaks.com/topic/52218-solved-stop-past-dates/#findComment-257555 Share on other sites More sharing options...
bubblegum.anarchy Posted May 21, 2007 Share Posted May 21, 2007 SELECT * FROM calendar WHERE Date >= CURRENT_DATE; Link to comment https://forums.phpfreaks.com/topic/52218-solved-stop-past-dates/#findComment-257920 Share on other sites More sharing options...
dmschenk Posted May 21, 2007 Author Share Posted May 21, 2007 Yay!! That was what I needed!! Many Thanks Dave Link to comment https://forums.phpfreaks.com/topic/52218-solved-stop-past-dates/#findComment-257923 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.