PDOStatement - Use grave accents (`) in columns?


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.


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!


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.


  • Unknown column '' in 'where clause'
  • Why is Perl system call failing to invoke internal Windows command?
  • How can the backticks (`) printed around these tables be escaped?
  • Creating foreign key in MySQL
  • Best way to handle offline and online development with Git
  • Jest - Cannot find module 'setupDevtools' from 'setup.js'
  • Why Is jQuery Not Submitting This Form? (Or What Have I Done Wrong? :-p)
  • Send money from Braintree
  • How to prompt user that edits have been made upon changing pages or sorting in Kendo Grid
  • Windows batch string manipulation in loop
  • Sum values in array of hash if they have the same value
  • Return to second to last URL in MVC (return View with previous filter conditions applied)?
  • Eloquent Relationship on Partial Match
  • How to repeat sections of a SQL query across UNIONs? (DRY in SQL)
  • XSLT foreach repeating nodes to flat
  • Redirect to Post Method/Action
  • MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL
  • Convert SQLite database to XML
  • Implicit joins and Where in Doctrine - how?
  • WPF Visiblity Binding to Boolean Expression with multiple Variables
  • Conversion from string “a” to type 'Boolean' is not valid
  • Button text different than value submitted in query string
  • Moving mysql files across servers
  • How to check if every primary key value is being referenced as foreign key in another table
  • Arrays break string types in Julia
  • Comma separated Values
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • log4net write single file for each call to log.info
  • Understanding cpu registers
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • embed rChart in Markdown
  • How to stop GridView from loading again when I press back button?
  • Add sale price programmatically to product variations
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app