tjverge Posted May 18, 2011 Share Posted May 18, 2011 Hi, I'm trying to get the records that are between two dates to show on my screen, right now nothing comes up my code I'm using is below $today = date('Y-m-d'); $lastweek = date('Y-m-d',strtotime('-7 days')); $sql = "SELECT * from `memos` WHERE `date` BETWEEN '$today' AND '$lastweek' AND `delete` !='1'"; $result = mysql_query($sql); echo "<ol>"; while ($row = mysql_fetch_array($result)) { echo "<li>".$row['memo']."</li>" ; } echo "</ol>"; Quote Link to comment https://forums.phpfreaks.com/topic/236802-getting-mysql-data-between-two-dates/ Share on other sites More sharing options...
tjverge Posted May 18, 2011 Author Share Posted May 18, 2011 fixed it if anyone wants to know you need to reverse the $today and $lastweek in the $sql Quote Link to comment https://forums.phpfreaks.com/topic/236802-getting-mysql-data-between-two-dates/#findComment-1217299 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.