ra_ie_darkness Posted March 28, 2013 Share Posted March 28, 2013 Hello, I am trying to retrieve some data through my php file from an ms access data base $sql = "Select AM_CheckInOut.[CheckInOut_Joint] as nr,AM_CheckInOut.[CheckTime] from AM_CheckInOut where AM_CheckInOut.[Person_Joint]=100170 and AM_CheckInOut.[DeviceID]=2 and mid(AM_CheckInOut.[CheckTime],1,10)='$fixdate';"; echo $sql.'<br/>'; $rs = odbc_exec($odbc_con,$sql) or die("query is not working"); if(!$rs) { echo "unable to execute query"; } while ($rs1= odbc_fetch_array($rs)) { $maxid = $rs1['nr']; echo 'Maximum ID'.$maxid.'<br/>'; } The column AM_CheckInOut.[CheckTime] contains timestamps. That looks something like 2010-06-22 12:42:50. The problem is that when i run the code it does not give me any result however if i paste the same query in msaccess it does return some values. The query that is shown on the browser is Select AM_CheckInOut.[CheckInOut_Joint] as nr,AM_CheckInOut.[CheckTime] from AM_CheckInOut where AM_CheckInOut.[Person_Joint]=100170 and AM_CheckInOut.[DeviceID]=2 and mid(AM_CheckInOut.[CheckTime],1,9)='2011-01-11'; What could be the issue Quote Link to comment https://forums.phpfreaks.com/topic/276250-msaccess-query-through-php/ Share on other sites More sharing options...
Solution Barand Posted March 28, 2013 Solution Share Posted March 28, 2013 (edited) try date format WHERE ... = #m/d/Y# in the query Edited March 28, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/276250-msaccess-query-through-php/#findComment-1421577 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.