0

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 ?

2 Answers 2

1

your table name (check)

is a reserved word in MySQL.

Surround it in backticks like this:

$mysqli->prepare("INSERT INTO `check` VALUES (?,?)");
Sign up to request clarification or add additional context in comments.

Comments

1

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 (?,?)");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.