Home >Backend Development >PHP Tutorial >mysqli - PHP 5.5 无法向MySql内创建新表,但在MySql内正常,连接正常。急!

mysqli - PHP 5.5 无法向MySql内创建新表,但在MySql内正常,连接正常。急!

WBOY
WBOYOriginal
2016-06-06 20:34:26918browse

$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命令行下执行能成功吗?不能的话看看语法有没有问题,语法没有问题的话看看你这个用户有没有权限。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn