Re: Database Array Question

From: Date: Mon, 22 Dec 2003 11:35:07 +0000
Subject: Re: Database Array Question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32154@lists.php.net to get a copy of this message
! - sign adds a negative meaning to the statement. Thus, if(!isset($_SESSION['uid'])) means = If (NOT isset($_SESSION['uid']))) you know that if(statement) will work if "statement" returns a "true" value...so if $_SESSION['uid'] is already set(has some value), isset($_SESSION['uid']) will also return a true value... so, by writting if(!isset()) { ...some_actions... }, some_actions will be executed only if uid session is not set (doesn't contain any value). Hope this helps, Muhammed Mamedov ----- Original Message ----- From: "Kieran Hood" <k_hood@ntlworld.com> To: <php-db@lists.php.net> Sent: Monday, December 22, 2003 1:26 PM Subject: [PHP-DB] Database Array Question > I'm new to PHP and was wondering if there's any better way of retrieving > the records from the query other than using an array (This query will only > return 1 row): > > $auth = mysql_query("SELECT username, userlevel, password, email FROM > users WHERE id = '".$_SESSION['uid']."'"); > while ($row = mysql_fetch_array($auth)) > { > $password = $row['password']; > } > > > Also, can anyone tell me what the relevance of adding '!' is to an if > statement eg. > > This: > if(!isset($_SESSION['uid'])) > > Instead of this: > if(isset($_SESSION['uid'])) > > > Thanks > -- > Using M2, Opera's revolutionary e-mail client: uÜ’÷æÜS™ >  <…´Ù¦http://www.opera.com/m2/ > > -- > Using M2, Opera's revolutionary e-mail client: > http://www.opera.com/m2/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.db (#32154) next »