该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
header("Content-type: text/html; charset=GBK");
/*数据库路径,请自己修改,否则可能运行不正常*/
$conn = @new COM("ADODB.Connection") or die("ADO连接失败!");
$connstr = "PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source=".realpath("access/access.accdb");
$conn->Open($connstr);
//创建记录集查询
$sql = "select * from pingjia";
$rs = new com("ADODB.RecordSet");
$rs->Open($sql, $conn, 1, 1);
$rs->MoveFirst();
//输出数据库字段名到表格标题
echo *
for ($i = 0; $i < $rs->Fields->count(); $i++)
{
echo *
*. $rs->fields($i)->name() . **;}
echo *
*;//输出数据库中记录到表格
while (!$rs->eof)
{
echo *
*;for ($j = 0; $j < $rs->Fields->count(); $j++)
{
echo *
* . $rs->Fields($j)->value . **;}
echo *
*;$rs->MoveNext();
}
echo *
*;?>