特定的select / update sql命令没有运行

I have a table with 2 columns "option" and "value". Both of them are varchar(50). option is set as primary.

I have this select command

mysqli_query($con,"SELECT value, option FROM menu_theme WHERE option='menu_height'");

And I have this update command

mysqli_query($con, "UPDATE menu_theme SET value='$_POST[value]' WHERE option='$_POST[command]'") or die($con->error);

Both of these commands break because of something wrong with the syntax near "option". I have no idea why.

  • The connection to the database is fine.
  • The UPDATE command is receiving the posted information fine.

This was an error I received when it tried to make the update command

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 'option='menu_height'' at line 1

OPTION is a MySQL reserved word which needs to be enclosed in backticks.

I.e.:

mysqli_query($con,"SELECT value, `option` FROM menu_theme WHERE option='menu_height'");