本文介绍了mysqli_connect在MAMP上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码在装有MAMP的旧iMac上运行.但是,它不适用于我的新iMac.我该如何解决?我需要对php.ini
文件做些什么?
The code below worked on my old iMac with MAMP. However, it does not work on my new iMac. How do I fix this? Do I need to do something to the php.ini
file?
<?php
$dbConnection = mysqli_connect("localhost", "xxxx", "xxxx", "gallery");
$query = "SELECT * FROM images";
$stmt = mysqli_prepare($dbConnection,$query);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $id, $categories,$img_name);
while (mysqli_stmt_fetch($stmt)) {
echo $id."<br />";
}
?>
推荐答案
您应该在PHP.ini中启用php_mysqli扩展.默认情况下它是禁用的.
You should enable php_mysqli extension in PHP.ini. It's disabled by default.
查找以下行:extension = php_mysqli
look for the following line: extension=php_mysqli
这篇关于mysqli_connect在MAMP上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!