Thanks for all the help. I was just placing the ! in the wrong place.

Thanks again,

Ed

 

On Fri, 7 Mar 2003, Greg Beaver wrote:

> 
> 
> Mincu Alexandru wrote:
> > On Fri, 2003-03-07 at 18:16, [EMAIL PROTECTED] wrote:
> > 
> >>Whenever I query a database with php I've always used the following code
> >>as a result.
> >>
> > 
> > this way:
> > 
> > if (!$row = mysql_fetch_array($result)) {
> > do something } 
> > else {
> > do seomthing else }
> 
> It is simpler to do this:
> 
> if ($row = mysql_fetch_array($result)) {
> do something else
> } else {
> do something
> }
> 
> You would be well advised to use this syntax:
> 
> if (!($row = mysql_fetch_array($result)))
> 
> to ensure operator precedence is clear. (the equals followed by not)
> 
> Regards,
> Greg
> --
> phpDocumentor
> http://www.phpdoc.org
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to