search a SUBSTRING of table entry
Posted: Wed May 14, 2008 3:33 am
Hi
what I want to do is retrieve some information from my database matching the first 10 digits of the field .
ie i have a date in this format '2008-05-14' and in the database it's as such '2008-05-14 23:38:37'
i though that something like this would work
but doesn't seem to work.
Thanks in advance for any help.
what I want to do is retrieve some information from my database matching the first 10 digits of the field .
ie i have a date in this format '2008-05-14' and in the database it's as such '2008-05-14 23:38:37'
i though that something like this would work
Code: Select all
$selectquery = "SELECT * FROM mynews WHERE SUBSTRING('newsdate',0,9) = '$todaysDate' ";
Thanks in advance for any help.