Re: RE: [PHP-DB] Best way to check if a query succeeded
| From: | Christian Reiniger | Date: | Fri, 30 Mar 2001 14:47:24 +0000 |
| Subject: | Re: RE: [PHP-DB] Best way to check if a query succeeded | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46321@lists.php.net to get a copy of this message | ||
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.