2013-06-21 187 views
0

我有這個疑問在這裏:與日期之間的日期時間和查詢的查詢問題

$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"; 

我得到這樣的錯誤: onversion從字符串轉換日期時間時失敗,SQL狀態

現在,如果我打印$ DM和$ DF我得到:

20130621;20130621; 

查詢工作正常,如果我只是把它像這樣:

$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"; 

有人幫助,請.. 感謝

+1

'data_fillim'的數據類型是什麼? –

回答

1

你嘗試轉換$ DM$ DF,toString()方法執行SQL字符串拼接時?

+0

我只是用這個... echo $ df = $ _ GET ['df']; echo $ dm = $ _ GET ['dm']; –