Jump to content

[SOLVED] Another mind numbing question on query dates BETWEEN


Recommended Posts

Sorry

 

After spending hours looking I think I need to post this question.

My code is:

$result = mysql_query("SELECT * FROM email WHERE printer LIKE '%$printer%' WHERE time BETWEEN '$date' '$todate'");

if ($cust=='all')
    {
    while($row = mysql_fetch_array($result))
    {
echo $row['printer']."  | ".$row['cust']," | ".$row['friend'];
    echo "</br>";
    }
    }
else if ($cust=='cust')
    {
while($row = mysql_fetch_array($result))

   {echo $row['printer']."  | ".$row['cust']," | ";
    echo "</br>";
}
    }
else if ($cust=='friend')
    {
	while($row = mysql_fetch_array($result))
    {
echo $row['printer']."  | ".$row['friend']," | ";
    echo "</br>";
    }
    }

 

This will not run at all. If I print out the values of $data and $todate they both show yy-mm-dd.

If I remove the time query then everything runs fine.

 

Really hit a brickwall. Do not that I have been cutting and adding to the code in the query so whats shown may have

a couple of typos in.

 

Cheers,

 

Spill.

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.