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 Link to comment https://forums.phpfreaks.com/topic/276250-msaccess-query-through-php/ Share on other sites More sharing options...
Barand Posted March 28, 2013 Share Posted March 28, 2013 try date format WHERE ... = #m/d/Y# in the query Link to comment https://forums.phpfreaks.com/topic/276250-msaccess-query-through-php/#findComment-1421577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.