drcomwc134525 2018-06-19 03:42
浏览 1084

您的SQL语法有错误; 查看与您的MariaDB服务器版本对应的手册,以获得正确的语法“

Through the prompt method ,i'm taking the name of the person to create a table .The method is working and the name is being parsed by the php script .But no matter what ,the table is not getting created and getting the following

ERROR: Could not able to execute CREATE TABLE kat (Item VARCHAR(50) , Quantity INTEGER, Price REAL).
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'kat (Item VARCHAR(' at line 1 "

echo("<script type='text/javascript'> var answer = prompt('Enter name'); </script>");
$na= "<script type='text/javascript'> document.write(answer); </script>";
$sql = "CREATE TABLE $na (Item VARCHAR(50) , Quantity INTEGER, Price REAL)"; 
if(mysqli_query($conn, $sql)){
    echo "Table created successfully.";}
else {
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
  • 写回答

2条回答 默认 最新

  • douzhun8615 2018-06-19 03:53
    关注

    add your connection into $con.

    评论

报告相同问题?