Re: Enclosing fields in MySQL queries with `" or '

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/03/07, Chris <dmagick@xxxxxxxxx> 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux