Page 1 of 1

How to Treat pulling Data from a field (Wild Cards?)

Posted: Thu Oct 19, 2006 1:38 am
by ridshack
Hi,

In the database the date and time in one field is like this:

Code: Select all

2006-09-07 23:20:27
I want to run a query based on the date and pay no attention to the time portion.

Code: Select all

$query  = "SELECT * FROM Tickets WHERE LastUpdatedBy='$tech' AND Queue='$client' AND LastUpdated='$date'";
This does work...

Code: Select all

$date = '2006-09-07 23:20:27';
But I only want to search by the dat and I cant figure uot the wild card.

These dont work.

Code: Select all

$date = '2006-09-07%';
$date = '2006-09-07*';


Thank you,
Jason

Posted: Thu Oct 19, 2006 2:01 am
by ridshack
The error was in my SQL statement.

Code: Select all

$query  = "SELECT * FROM Tickets WHERE LastUpdated like '$date'";
But it dosent work when I try to add the rest like

Code: Select all

$query  = "SELECT * FROM Tickets WHERE LastUpdatedBy='$tech' AND Queue='$client' AND LastUpdated like '$date'";
Is there anything wrong with this? Besides not working (-:

Jason

Posted: Thu Oct 19, 2006 2:03 am
by itsmani1
use : date_format