Heim >Backend-Entwicklung >PHP-Tutorial >mysqli - PHP 5.5 无法向MySql内创建新表,但在MySql内正常,连接正常。急!
$con= mysqli_connect("localhost","root","","questionnair");
$sql="create table $username(id int(20) AUTO_INCREMENT primary key,questionnair_name varchar(200),questionnair varchar(200),answer_a varchar(200),answer_b varchar(200),answer_c varchar(200),answer_d varchar(200),a int(20),b int(20),c int(20),d int(20),two_code varchar(200),issuer varchar(100));";
mysqli_query($con,$sql);
$con= mysqli_connect("localhost","root","","questionnair");
$sql="create table $username(id int(20) AUTO_INCREMENT primary key,questionnair_name varchar(200),questionnair varchar(200),answer_a varchar(200),answer_b varchar(200),answer_c varchar(200),answer_d varchar(200),a int(20),b int(20),c int(20),d int(20),two_code varchar(200),issuer varchar(100));";
mysqli_query($con,$sql);
直接在mysql命令行下执行能成功吗?不能的话看看语法有没有问题,语法没有问题的话看看你这个用户有没有权限。