php+access连接数据库问题
<?php$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("../my.mdb");
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
$rs->Open("select * from 出库表",$conn,1,1);
while(! $rs->eof) {
$f = $rs->Fields(1);
echo $f->value;
echo " ". $rs->Fields(2)->value;
$rs->MoveNext();
}
?>
以上代码连接数据库出错(Fatal error: Class 'com' not found in D:\WWW\cs\3.php on line 2)我的数据库放在php文件同一目录
第二段代码
$db="my.mdb"
$connstr="provider=Microsoft.jet.OLEDB.4.0;Data source="& Server.MapPath($db)
set conn=Server.CreateObject("ADODB.Connection")
conn.open $connstr
也出错(Parse error: syntax error, unexpected T_VARIABLE in D:\WWW\cs\3.php on line 3)
我倾向于用第二种方法连,请高手指点