I'm having trouble with this query. I have 2 date coming from textboxes (don't worry I've taken the necessary sql injection steps). They are used to query a MS SQL Server DATETIME field. I'm getting this error:
Conversion failed when converting date and/or time from character string
Here my code:
//formatting my strings
$from = strtotime($from);
$to = strtotime($to);
//this is the where clause in the SQL statement
"WHERE (tblBackupArchive.BackupDate BETWEEN '" . $from ."' AND '" . $to . "') "
What am I doing wrong?
Jonesy