Jump to content

MsAccess query through PHP


ra_ie_darkness
Go to solution Solved by Barand,

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.