Re: Value of $_* variables
| From: | Mike Eheler | Date: | Tue, 05 Mar 2002 21:22:03 +0000 |
| Subject: | Re: Value of $_* variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87355@lists.php.net to get a copy of this message | ||
$result = mysql_query("select user from users where id = $_SESSION[id]", $db);
No need to quote the key name in a string.
Mike
James Taylor wrote:
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?