php +access2007代码查询日期死活不通过解决思路

WBOY
Release: 2016-06-13 11:15:59
Original
1074 people have browsed it

php +access2007代码查询日期死活不通过
Access中的日期比较、查询需要用#2003-1-1#,就像对字符串是''一样。

我用php +access2007
发现代码查询日期死活不通过  (确认是日期字段 rq问题 ,换其他字段都通过的)
代码如下
$db = ADONewConnection('ado_access'); 
$access = realpath('../data.mdb'); 
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'.'DATA SOURCE='. $access . ';'."Jet OLEDB:Database Password=12;"; 

$db->Connect($myDSN); 
$mtime="2012-12-3";
$mtime = date("#Y-m-d#",$mtime);
$arr=array($LOGIN_USER_NAME,$mtime);
$recordSet = $db->Execute('select username,rq,times,sbzt,xbzt from kq where username=? and rq=?',$arr);
rq是日期短日期类型如2012-12-3 
求解


------解决方案--------------------
$mtime = date("#Y-m-d#",$mtime);
怎么对呢?
$mtime = "#$mtime#";

date 的第二个参数是 unix时间戳
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template