• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

When to use ' ' vs ` ` ?

TheBigK

Well-known member
#1
I'm not sure how to describe this. But here's a code from my datawriter that was throwing error "The field sf_id is not recognised'. I had to change the `sf_id` to 'sf_id'

'sf_id' => array('type' => self::TYPE_UINT, 'autoIncrement' => true),

I've seen that many times while writing SQL queries, I must use `something` over 'something'. Can someone point out the difference?
 

Chris D

XenForo developer
Staff member
#3
` (backtick) is pretty much used exclusively to escape column and table names in MySQL.
' (single quote) is used to enclose strings in PHP and MySQL. In most cases you can also use " (double quote)