Re: Enclosing fields in MySQL queries with `" or '
| From: | Dotan Cohen | Date: | Wed, 07 Mar 2007 18:22:00 +0000 |
| Subject: | Re: Enclosing fields in MySQL queries with `" or ' | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250023@lists.php.net to get a copy of this message | ||
On 05/03/07, Chris <dmagick@gmail.com> wrote:
Dotan Cohen wrote:
Are there any advantages/disadvantages to using and of the ` " or '
punctuation symbols in MySQL queries? I usually only put them around
variables (after being sanitized, of course):
INSERT INTO places (country, city) VALUES ('$country', '$city')
Any thoughts on the issue? Thanks.
Single quotes are supported in any db (mysql, postgres, sqlite etc etc)
- so use them. No idea if double quotes are widely supported.
A backtick (`) on the other hand is a mysql-ism. It allows you to use
keywords as field names (eg index) amongst other things (including
quoting strings).
--
Postgresql & php tutorials
http://www.designmagick.com/
Thanks. I'll just keep using single quotes then, as I've always done.
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/338/meat_loaf.html
http://what-is-what.com/what_is/404.html