0
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错误。我很确定我没有在我的 php 中使用 msql。

4

2 回答 2

1

改变这个

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

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

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

于 2013-03-30T06:00:51.070 回答
0

的签名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 文档

于 2013-03-30T06:00:34.820 回答