PHP連接Access伺服器代碼

使用php的odbc函數,不創建數據源。
$connstr=”DRIVER=Microsoft Access Driver (*.mdb);DBQ=”.realpath(“test.mdb”) ;
$connid=odbc_connect($connstr,””,””,SQL_CUR_USE_ODBC );

親試代碼,可用哦。

Php + Access sample code.

<?php
/***
  This file is just for an example of Php+Access.
  You can find these functions from https://www.php100.com/cover/php/1681.html
*/

/* ODBC string */
$odbc = "Driver={Microsoft Access Driver (*.mdb)};Dbq=".realpath("our.mdb");

$conn = odbc_connect($odbc, '', '', SQL_CUR_USE_ODBC);

$sql ="select * from test";

$query = odbc_exec($conn, $sql);

print $query."
"; $num = odbc_num_fields($query); if ($num != 0) for($i=1; $i".odbc_result($query,"Addr")."
"; //echo "->".odbc_result($query,3)."
"; /* the same as Line 24*/ } else print "No data"; ?>

發佈留言