用php连接access数据库

有部分cms的数据库是access而且保存为了datas.asp,那么用php连接就应该是这样:

<?php //读取mdb数据库例程
header("Content-type: text/html; charset=gb2312");
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("inc/datas.asp");
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");

$rs->Open("select m_id,m_name,m_addtime,m_playdata,m_datetime from m_data where Day(m_addtime)=Day(now()) and Month(m_addtime)=Month(now()) and Year(m_addtime)=Year(now()) order by m_datetime",$conn,1,1);
while(! $rs->eof) {	
	echo $rs->Fields(0)->value;
}
?>

用php连接access数据库:等您坐沙发呢!

发表评论

表情
还能输入210个字