Jump to content

[SOLVED] Another mind numbing question on query dates BETWEEN


spillage

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.

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.