Search code examples
phpphpmyadminsql-updateslash

How can I do a Update with slash on MySQL?


Hello I try do a Update like this

$sql = "UPDATE info SET YES/NO = '$_POST[value]' WHERE ID = '$_POST[id]'";

I am getting this error:

Error updating record: 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 '/NO = 'YES' WHERE ID = '5'

I think this can be error from use SLASH on my database, If it is the problem how can i solve it?, thanks and i cant find any on google working for it.


Solution

  • Usualy, anything different than alphanumeric and underscore is not recommended.

    Indeed, it is not a good practice to name a colomn like you did.

    I will recommend you to rename the colomn yes_no otherwise, you will get the same error again, again and again.