Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.