RE: [PHP] sql query successful

From: Date: Wed, 18 Jul 2001 19:50:53 +0000
Subject: RE: [PHP] sql query successful
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58511@lists.php.net to get a copy of this message
Mark Roedel pressed the little lettered thingies in this order... > > -----Original Message----- > > From: Christopher Ostmo [mailto:tech@appideas.com] > > Sent: Wednesday, July 18, 2001 2:43 PM > > To: php-general@lists.php.net > > 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 > http://www.php.net/manual/en/language.operators.assignment.php) > > 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. > Thank you. I've never tried to "assign" within an if() clause. You learn 13 or 14 new things every day... Christopher Ostmo a.k.a. tech@AppIdeas.com AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) For a good time, http://www.AppIdeas.com/

« previous php.general (#58511) next »