Re: Database Array Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



! - 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@xxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Monday, December 22, 2003 1:26 PM
Subject:  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: 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
>

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux