$dbHeader = mysqli_connect("host", "username", "password", "db");
我使用它来连接到数据库,它的工作原理。我试过这个
$table = "users";
$query = "
CREATE TABLE IF NOT EXISTS $table(
id int(0) AUTO_INCREMENT,
userId bigint(0),
username varchar(200),
firstName varchar(200),
lastName varchar(200),
PRIMARY KEY (id)
)
";
$qu = mysqli_query($dbHeader, $query);
并且它不起作用所以我直接尝试了表的名称并且它有效。我刚试过其他查询和各种方法,如
$stmt = mysqli_prepare($dbHeader, "INSERT INTO users (userId, username, firstName, lastName) values (?,?,?,?)");
mysqli_stmt_bind_param($stmt, $userId, $username, $firstName, $lastName);
mysqli_stmt_execute($stmt);
但它仍然无效。