im writing a app that checks user status im using mysql and i want to have a table name check
this is my code :
mysqli_report(MYSQLI_REPORT_ALL);
$stmt = $mysqli->prepare("INSERT INTO check VALUES (?,?)");
i get error :
Uncaught exception 'mysqli_sql_exception' with message '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 'check VALUES (?,?)' at line 1'
what am i doing wrong ?
check
is a reserved word
in MySQL . Enclose it in backticks !
Like this
mysqli_report(MYSQLI_REPORT_ALL);
$stmt = $mysqli->prepare("INSERT INTO `check` VALUES (?,?)");
your table name (check)
is a reserved word in MySQL.
Surround it in backticks like this:
$mysqli->prepare("INSERT INTO `check` VALUES (?,?)");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.