Re: cvs: phpdoc /en/reference/mysql/functions [snip]

From: Date: Fri, 20 Feb 2004 18:49:02 +0000
Subject: Re: cvs: phpdoc /en/reference/mysql/functions [snip]
References: 1 2 3 4  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969359117@lists.php.net to get a copy of this message
On Fri, Feb 20, 2004 at 07:23:23PM +0100, Georg Richter wrote: > > > Converting examples to the "preferred method"s of doing something... > > > quotes from the CS: > > > ERROR HANDLING > > or die() is ok when connection method fails. Nobody will use a die within a > script e.g. if a query failed! That's bad style. IMHO, it's bad style everywhere to use a boolean operator for error-checking... but maybe that's a matter of preference. > > > > 3. Use single quotes ' when appropriate. > > So what is the appropiate way? > > a) mysql_query("SELECT col FROM foo WHERE bar='test'"); > b) mysql_query('SELECT col FROM foo WHERE bar="test"''); > c) mysql_query('SELECT col FROM foo WHERE bar=\'test\''); ? IMO, a) because using " inside a query is not valid SQL and escaping decreases readability. > Georg -- Regards, Stefan Walk <swalk@prp.physik.tu-darmstadt.de>

« previous php.doc (#969359117) next »