警告:mysqli_query()期望参数1是mysqli错误


Warning: mysqli_query() expects parameter 1 to be mysqli error

include_once("php/db_connects.php");
$tbl_status = "CREATE TABLE IF NOT EXISTS status ( 
                id INT(11) NOT NULL AUTO_INCREMENT,
                osid INT(11) NOT NULL,
                account_name VARCHAR(16) NOT NULL,
                author VARCHAR(16) NOT NULL,
                type ENUM('a','b','c') NOT NULL,
                data TEXT NOT NULL,
                postdate DATETIME NOT NULL,
                PRIMARY KEY (id) 
                )"; 
$query = mysqli_query($tbl_status, $db_connects); 
if ($query === TRUE) {
    echo "<h3>status table created </h3>"; 
} else {
    echo "<h3>status table NOT created </h3>"; 
}

我一直得到mysqli错误。我很确定我没有使用msql在我的php

change this

$query = mysqli_query($tbl_status, $db_connects); 

$query = mysqli_query($db_connects, $tbl_status); 

示例mysqli_query(mysqli $link, string $query)

mysqli_query的签名为:

mixed mysqli_query ( mysqli $link , string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )

假设$db_connects是存储mysqli_connect结果的变量,您需要翻转您的参数以适合:

mysqli_query($db_connects, $tbl_status); 

mysqli_query文档