Update SQL syntax for two variables

01.02.2012

There is a trick regarding the “UPDATE” command for SQL, it won’t work like it does for “INSERT”, “SELECT” or “DELETE”, when you have two or more variables like “$updateSQL = “UPDATE table SET id1 = ’1′ && id2 = ’1′”.

The “AND” or the “&&” syntax works for “INSERT”, “SELECT” and “DELETE”.

The correct syntax for the “UPDATE” SQL command when having more than a variable is: “$updateSQL = “UPDATE table SET id1 = ’1′, id2 = ’2′“. So, the comma will work instead of the “AND” or “&&”.

Phpmyadmin








Leave a Reply

*
*