$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("db1.mdb"));
$rs = $conn->Execute("SELECT * FROM table1"); // Recordset
$num_columns = $rs->Fields->Count();
//echo $num_columns . "
";
for ($i=0; $i < $num_columns; $i++) {
$fld[$i] = $rs->Fields($i);
}
$rowcount = 0;
while (!$rs->EOF) {
for ($i=0; $i < $num_columns; $i++) {
echo $fld[$i]->value . " ";
}
echo "
";
$rowcount++; // increments rowcount
$rs->MoveNext();
}
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
?>
阅读(1047) | 评论(1) | 转发(0) |