Jump to content

getting mysql data between two dates


tjverge

Recommended Posts

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>";

Link to comment
https://forums.phpfreaks.com/topic/236802-getting-mysql-data-between-two-dates/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.