Reputation: 9
I have this query here:
$result = "SELECT forma.*, SMS_MONTIME.IDTICKET, SMS_MONTIME.MBYLLUR,SMS_MONTIME.time_added
FROM forma
LEFT JOIN SMS_MONTIME ON forma.ID = SMS_MONTIME.IDTICKET WHERE forma.data_fillim >= '".$df."' AND forma.data_fillim <= '".$dm."' ORDER BY forma.id DESC";
I get an error like this: onversion failed when converting datetime from character string., SQL state
Now if i print $dm and $df i get:
20130621;20130621;
The query works fine if i just put it like this:
$result = "SELECT forma.*, SMS_MONTIME.IDTICKET, SMS_MONTIME.MBYLLUR,SMS_MONTIME.time_added
FROM forma
LEFT JOIN SMS_MONTIME ON forma.ID = SMS_MONTIME.IDTICKET WHERE forma.data_fillim >= '20130621' AND forma.data_fillim <= '20130621' ORDER BY forma.id DESC";
Someone help please.. Thanks
Upvotes: 0
Views: 52
Reputation: 4726
Did you try converting $dm and $df, ToString() when doing the concatenation of the SQL string?
Upvotes: 1