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
<[EMAIL PROTECTED]>

Reply via email to