Create mysql table with php variable not working

后端 未结 4 1007
生来不讨喜
生来不讨喜 2020-12-07 06:28

I\'m pretty new to php.. and this is probably a stupid mistake... but I have no idea what is going on. I\'m trying to create a table in my database using php. I want to name

4条回答
  •  一整个雨季
    2020-12-07 07:16

    you have invalid concatenation of string, use double quotes instead of single quotes.

    $create = "CREATE TABLE `".$tableusername."` ("
        . " `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, "
        . " `please` VARCHAR(50) NOT NULL, "
        . " `make` VARCHAR(50) NOT NULL, "
        . " `this` VARCHAR(50) NOT NULL, "
        . " `work` VARCHAR(50) NOT NULL' "
        . " )"
        . " ENGINE = myisam;";
    

提交回复
热议问题