Mysql/PHP quotes problem!
Is there any difference between `` o开发者_如何学编程r " " or ' ' quotes in mysql query when assessing Mysql databse through PHP?
` (back ticks) are used to escape column/table names if you use spaces or commas in your names (don't!) or have columns that are named like functions, for example: AVG, MIN etc.
You usually use double quotes to start/end a string in PHP. That leaves you with single quotes to start/end strings in your MySQL query.
MySQL: The back tick is used as identifier quote character, you should use it when in name declarations, even more when you have names with special characters like blanks or reserved words (avoid it - you'll safe yourself some trouble!).
Single and double quotes are nearly the same, afaik there's just a minor difference::
If the ANSI_QUOTES SQL mode is enabled, string literals can be quoted only within single quotation marks because a string quoted within double quotation marks is interpreted as an identifier.
Reference: http://dev.mysql.com/doc/refman/5.1/en/string-syntax.html
PHP: There's a big difference between single and double quotes:
Variables and escape sequences for special characters will not be expanded when they occur in single quoted strings.
Reference: http://ca.php.net/types.string
精彩评论