gpt4 book ai didi

php - 使用 PHP Access MS Access 数据库的最佳方式是什么?

转载 作者:搜寻专家 更新时间:2023-10-30 21:53:50 25 4
gpt4 key购买 nike

我需要从 MS Access 数据库 Access 一些数据并使用 PHP 从中检索一些数据。

我浏览了整个网络,发现以下行似乎正确连接到数据库:

$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\wamp\www\data\MYDB.mdb");

但是,我尝试通过以下方式检索一些数据:

$query = "SELECT pageid FROM pages_table";
$result = mysqli_query($conn, $query);

$amount_of_pages = 0;

if(mysqli_num_rows($result) <= 0)
echo "No results found.";
else
while($row = mysqli_fetch_array($result, MYSQL_ASSOC))
$amount_of_pages++;

并出现以下错误:

Warning: mysqli_query() expects parameter 1 to be mysqli, object given in C:\wamp\www\data\index.php on line 19

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\data\index.php on line 23 No results found.

我不太了解与 Access 数据库的连接,有什么我应该做的不同的事情吗?

在此先感谢您的帮助。

最佳答案

我不认为你可以将 MySQLi 与 MySQL 数据库以外的任何东西一起使用。您可能需要使用 ODBC connection .

关于php - 使用 PHP Access MS Access 数据库的最佳方式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4584156/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com