Re: [PHP] Enclosing fields in MySQL queries with ` or '

2007-03-13 Thread Dotan Cohen

On 13/03/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Wed, March 7, 2007 1:22 pm, Dotan Cohen wrote:
 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).

I *think* that this is actually SQL-92 specification, but don't quote
me on that.

You can use `foo` to make the SQL parser know that foo is not a
reserved word but an identifier...



I'm usually careful not to name my fields select, from, where,
and the like. But if I ever need it, now I know. Thanks.

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/646/tesla.html
http://what-is-what.com/what_is/wikipedia.html

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



Re: [PHP] Enclosing fields in MySQL queries with ` or '

2007-03-12 Thread Richard Lynch
On Wed, March 7, 2007 1:22 pm, Dotan Cohen wrote:
 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).

I *think* that this is actually SQL-92 specification, but don't quote
me on that.

You can use `foo` to make the SQL parser know that foo is not a
reserved word but an identifier...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Enclosing fields in MySQL queries with ` or '

2007-03-07 Thread Dotan Cohen

On 05/03/07, Chris [EMAIL PROTECTED] 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



[PHP] Enclosing fields in MySQL queries with ` or '

2007-03-04 Thread Dotan Cohen

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.

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/135/creed.html
http://what-is-what.com/what_is/adsl.html

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