![](/img/trans.png)
[英]How to fix Warning: mysqli_query() expects parameter 2 to be string
[英]How to fix: Warning: mysqli_query() expects parameter 1 to be mysqli?
我正在尝试在我的主机上安装 Arfooo。
首先,我收到了一个警告:
Deprecated: mysql_connect()
修复后,现在我收到此错误:
function executeQueryWithPrefix($sql, $tablesPrefix)
{
$sql = str_replace("CREATE TABLE `", "CREATE TABLE `" . $tablesPrefix, $sql);
$sql = str_replace("INTO `", "INTO `" . $tablesPrefix, $sql);
//echo $sql."<br>";
return mysqli_query($sql);
}
function dbConnect($server, $user, $pass, $dbName)
{
/* install database with prefixed tables */
mysqli_connect($DB_HOST, $user, $pass, $dbName);
//mysql_connect($server, $user, $pass) or die('could not connect to mysql');;
mysqli_query($dbName, 'CREATE TEMPORARY TABLE `table`');
//mysql_query('create database IF NOT EXISTS ' . $dbName);
mysqli_select_db($dbName) or die('could not select database');
}
请帮忙! 谢谢!
$link = mysqli_connect($DB_HOST, $user, $pass, $dbName);
mysqli_query($link, 'CREATE TEMPORARY TABLE `table`');
使用 mysqli,您需要将连接保存在变量中,并在每次使用 mysqli 时提供该连接。
编辑:通常:您需要为您使用的每个与 mysqli 相关的函数提供连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.