Jump to content

MsAccess query through PHP


ra_ie_darkness

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.