Heim  >  Artikel  >  Backend-Entwicklung  >  php +access2007代码查询日期死活不通过解决思路

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

WBOY
WBOYOriginal
2016-06-13 11:15:591049Durchsuche

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时间戳
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn