Jump to content

[SOLVED] Select BETWEEN dates


timmah1

Recommended Posts

This query returns 0 results, even though there are 9 dates between the two.

 

Can anybody tell me why?

 

<?php
$sql = "SELECT * FROM lunch WHERE person = '".$_GET['id']."' AND date BETWEEN '".date("Y-m-d")."' AND '".date("Y-m-d", strtotime("+ 7 Days"))."'";
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);

if($numrows == 0 ){
echo "No lunch for $p1 entered right now";
}
?>

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/160538-solved-select-between-dates/
Share on other sites

I apologize Maq, and thank you, that worked like I needed it to

 

And roopurt18, you could have kept your comment to yourself, because in essence, you did tell me something :-)

 

 

Hehe :)

 

What I meant was I'm not helping you fix the problem you asked for help with until you fixed your other more serious problems.

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.