Re: [PHP] Value of $_* variables

2002-03-05 Thread Chris Boget

> $result = mysql_query("select user from users where id = $_SESSION['id]", 
> $db);
> That just doesn't work, so I have to first go:
> $sid = $_SESSION['id'];
> $result = mysql_query("select user from users where id = $sid", $db);
> Anyway to get around this?

I'm sure that either

mysql_query("select user from users where id = " . $_SESSION['id'], $db);

or 

mysql_query("select user from users where id = {$_SESSION['id']}", $db);

will work.

One thing to note in case you cut and pasted that first line above, you are
missing one of your single quotes around id.  That might be throwing you
off as well.

Chris


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




[PHP] Value of $_* variables

2002-03-05 Thread James Taylor

I'm sure this has been asked before, but at least not within the last 600 
messages (i checked):

I have the session variable $_SESSION['id'] set.  Well, I want to actually 
check the value of this variable, not just to check if it's set.  I would be 
doing this in a mysql query mainly.  Something like:

$result = mysql_query("select user from users where id = $_SESSION['id]", 
$db);

That just doesn't work, so I have to first go:

$sid = $_SESSION['id'];
$result = mysql_query("select user from users where id = $sid", $db);

Anyway to get around this?

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