Rumah > Soal Jawab > teks badan
$conn = new mysqli($serverName, $MYSQLUserName, $MYSQLPwd);
$sql = "use WA";
if($conn->query($sql)){
} else{
if($conn->error == "Unknown database 'wa'"){
$sqlCreateDatabase = "create database WA;";
$sqlCreateDatabase .= "alter database WA character set utf8;";
$conn->multi_query($sqlCreateDatabase);
$sqlCreateTable = "create table userInfo(
id smallint unsigned primary key auto_increment,
userName varchar(30),
pwd varchar(6)
);";
if($conn->query($sqlCreateTable)){
echo("success");
} else{
echo($conn->error);
}
}
}
数据库WA成功创建,字符集也修改了。但数据表没能创建成功。
报错:Commands out of sync; you can't run this command now
百度了下没找到解决方法,说是得先清空结果集,试了下也没成功。请大神帮忙。
错误明显是从第14行开始的。在14行前面应该是要释放一下什么东西,请问这个东西要怎么释放。