根据变量的结果创建名称为的新表失败


Create new table with the name as a resultant from a variable is failing

我想要它,这样每次有新人在我的网站上注册时,它都会专门为他们创建一个新表。这是针对我正在实现的文件系统。但是,当尝试使用变量作为表的名称时。这似乎给了我一个错误。我想知道是否有人知道为什么。

下面的代码是我的创建表代码,我已经在脚本的早些时候连接并选择了一个数据库,所以这不是的问题

$newuser = $_POST['username'];
$create = "CREATE TABLE".$newuser." (
                                column_one varchar (20) NOT NULL,
                                column_two int NOT NULL auto_increment PRIMARY KEY,
                                column_three int NOT NULL,
                                column_four varchar (15) NOT NULL,
                                column_five year
)";
$results = mysql_query($create) or die (mysql_error());

然后我得到错误。。。

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLEAdministrator9 ( column_one varchar (20) NOT NULL, column' at line 1

然而,当只是把它命名为"土豆"时,它会继续创建它。所以我想知道,当我想让它使用变量$newuser的结果时,我使用的语法是否有问题。

我是后端编程的新手。

感谢

您缺少一个空格:

$create = "CREATE TABLE ".$newuser." (
-----------------------^
                                column_one varchar (20) NOT NULL,
                                column_two int NOT NULL auto_increment PRIMARY KEY,
                                column_three int NOT NULL,
                                column_four varchar (15) NOT NULL,
                                column_five year
)";