Hi all,
I am trying to write a SELECT statement that uses LIKE.
The query needs to lookup all the records that have a date submitted by the user, VARIABLE.
The user submits the date in the format of "d-m-Y" so then I reformat to "Y-m-d". The date the the database is stored as "Y-m-d H:i" but I only want the query to use "Y-m-d", is this possible.
So far I have:
$colname_Date = "-1";
if (isset($_POST['HandoverFromDate'])) {
$colname_Date = date("Y-m-d", strtotime($_POST['HandoverFromDate']));
}
sprintf("SELECT UniqueID, ReportType, ItemType, Department FROM Instant WHERE ReportDateTime LIKE '% $colname_Date %'")
I get the following error: Warning: sprintf() [function.sprintf]: Too few arguments. Query was empty.
Many thanks in advance for your help.
Blackbox