php-general | 2001032

Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded From: Christian Reiniger (creinig <email protected>)
Date: 03/30/01

On Friday 30 March 2001 16:25, you wrote:
> > Wouldn't doing it like this however be ok:
> > if ($result = mysql_query($query)) {
>
> I could be wrong, but I do not believe so. The

You are wrong :)

($result = mysql_query(...))
assigns a value to result, and the entire expression evaluates to that
value (i.e. the return value of mysql_query).
 
> if( $i = "bob" ) {
> // this will always run.

yes, because "bob" evaluates to true :)

>
> }

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Even idiots can handle computers, and many do.

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>