86Stang Posted November 2, 2009 Share Posted November 2, 2009 I've built a basic for loop to loop through the next two weeks worth of days: $qry = "SELECT live_date FROM table"; $result = mysql_query($qry) or die("Error during query!"); $days_outlook = 14; $cur_date = date('Y-m-d'); for ($i=strtotime($cur_date);$i<strtotime(date("Y-m-d", strtotime($cur_date)) . " +$days_outlook days");$i+=86400) { echo date('Y-m-d', $i) . "<br>"; } Works great. What I'd like to do now is compare each date in the loop with the 'live_date' column of a database and if the looping date matches a date within the 'live_date' column don't display it (or maybe display it differently than the dates with no match). Any chance I can get a hand on this? Link to comment https://forums.phpfreaks.com/topic/180022-looping-through-dates-and-seeing-if-theres-a-match-in-the-db/ Share on other sites More sharing options...
86Stang Posted November 2, 2009 Author Share Posted November 2, 2009 By the way, if there's no easier way of doing this, I'm all ears! Link to comment https://forums.phpfreaks.com/topic/180022-looping-through-dates-and-seeing-if-theres-a-match-in-the-db/#findComment-949764 Share on other sites More sharing options...
86Stang Posted November 3, 2009 Author Share Posted November 3, 2009 Anyone? Again, if this is the completely wrong way of doing it, feel free to school me! Link to comment https://forums.phpfreaks.com/topic/180022-looping-through-dates-and-seeing-if-theres-a-match-in-the-db/#findComment-950320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.