<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2017/12/12
* Time: 12:32
*/
header("Content-Type:text/html; charset=utf-8"); //设置编码
$dsn="DRIVER=Microsoft Access Driver (*.mdb);DBQ=".realpath("data.mdb");//设置access数据库路径
$conn=odbc_connect($dsn,"","780910",SQL_CUR_USE_ODBC );//链接
$sql="select * from BaseXM";
$query=odbc_do($conn,$sql);
$i=1;
while(odbc_fetch_row($query)){
//转码(防止乱码)
echo "第".$i."条记录!"; echo "<br/>";
echo "编号:".@iconv('gb2312','utf-8',odbc_result($query,1));
echo "<br/>"; echo "项目:".@iconv('gb2312','utf-8',odbc_result($query,2));
echo "<br/>";
echo "<hr/>";
$i++;
}
if($i<2){
echo "对不起,数据表为空! ";
}
?>
网友评论