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

From: Date: Sun, 04 Mar 2007 23:26:45 +0000
Subject: Re: Enclosing fields in MySQL queries with `" or '
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-249838@lists.php.net to get a copy of this message
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/

« previous php.general (#249838) next »