Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
ridshack
- Forum Commoner
- Posts: 29
- Joined: Wed Oct 11, 2006 10:34 pm
Post
by ridshack »
Hi,
In the database the date and time in one field is like this:
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...
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
-
ridshack
- Forum Commoner
- Posts: 29
- Joined: Wed Oct 11, 2006 10:34 pm
Post
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
-
itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
-
Contact:
Post
by itsmani1 »
use : date_format