TimGreenwood Posted March 9, 2018 Share Posted March 9, 2018 In the following code block, how do I limit the query to WHERE $DATE >= Today's date? (This is OLD code - and I'm neither very good at PHP nor SQL - so be kind.) (I've looked up every reference I could find and spent hours getting it THIS far - and can't seem to make it over this last hurdle. PLEASE HELP.) <? if (!isset($offset)) $offset = 0; $limit = 32; // this detemines max records per page $users_query = "SELECT * FROM ItineraryTim ORDER BY date DESC"; $users_limit = " LIMIT " . $offset . "," . $limit; //$users_limit = " where date>=GetDate() " . $limit; $users_display = @mysql_query($users_query.$users_limit) or die ("ERROR: The query failed."); while ($row = @mysql_fetch_array($users_display)) { $LINEID = $row["LineID"]; $LOCATION = $row["Location"]; $EVENT = $row["Event"]; $DAYTIME = $row["DayTime"]; $CONTACT = $row["Contact"]; $DATE = $row["Date"]; $TIME = $row["Time"]; // $DATE = date("F j, Y", $DATE); // Displays ALL dates as January 1, 1970. //$date = $row['date']; //echo date("d.m.Y H:i:s", strtotime($date)); // *************** Begin Event Display ********************** echo "<center><h2><font color=#bca255>". date("F j, Y", strtotime($DATE)). "</font></h2><p><b>$DAYTIME @ <font color=#993399>$EVENT</font><br>in $LOCATION</b></center><hr><p><p>"; // *************** End Event Display ************************ } //recordsetNav($mysql_link,$users_query,$PHP_SELF,$offset,$limit,'100%',1); echo "<a href='mailto:staff@tgm.org?Subject=From TGM Speaking Schedule'>Email us for specific directions.</a>"; @mysql_close($mysql_link); ?> Quote Link to comment https://forums.phpfreaks.com/topic/306780-where-date-today/ Share on other sites More sharing options...
requinix Posted March 9, 2018 Share Posted March 9, 2018 SELECT * FROM ItineraryTim ORDER BY date DESCThat's your query. You should already know what the date column in the table is, and the current date is CURDATE(). Quote Link to comment https://forums.phpfreaks.com/topic/306780-where-date-today/#findComment-1557042 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.