> -----Original Message-----
> From: Christopher Ostmo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 2:43 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] sql query successful
> Your statement above is checking to see if the fact that $sql
> is equal to mysql_query("SELECT * FROM table ORDER BY rand()")
> is TRUE, but you're using an assignment operator (=) and not a
> comparison operator (==), so it should always return FALSE. (Can
> you use an assignment operator in an if() statement?)
Actually, you can. (See
An assignment operation will return the value that was assigned.
Thus, if we have
if ($sql = mysql_query($query_string))
and the mysql_query call returns a non-false value, the entire
expression will evaluate to true.
Mark Roedel | "The most overlooked advantage to owning a
Systems Programmer | computer is that if they foul up there's no
LeTourneau University | law against whacking them around a little."
Longview, Texas, USA | -- Owen Porterfield
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]