Looking at the PHP manual, does not, at any time, the suggestion to include the grave accents on the columns.
For example: recently, I was trying to run the function below:$pdo->prepare("UPDATE name_table SET convert= :convert, payment = :payment WHERE id = :id")
After repeated attempts to try to update the data in MySQL, I noticed that the CONVERT function is a function of the native MySQL.
So after that, put the backticks in the columns and it worked:$pdo->prepare("UPDATE name_table SET `convert`= :convert, `payment` = :payment WHERE id = :id")
<br /> Does anyone believe that the grave accents are not essential to the object PDOStatements? Just tried to MySQL, but do not know if it really is good to use backticks to further change the database.Answer1:
As you say yourself, your query didn't work because
CONVERT is a <a href="http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html" rel="nofollow">reserved word</a> in mySQL, and whenever using column names that are reserved words - or have other weird characteristics - you need to wrap them in backticks.
There's no harm in using backticks for every column and table name. Just don't use them on <em>data</em> - that doesn't work. For data, use quotes instead.
<strong>Edit after @Beau's answer:</strong> Note that this applies only to mySQL!Answer2:
I would imagine backticks are not required or mentioned because they are specific to mysql and PDO was designed to be used with any RDMS.