Pushing Vars into $_SESSION
| From: | Chris Grigor | Date: | Tue, 18 Apr 2006 15:05:08 +0000 |
| Subject: | Pushing Vars into $_SESSION | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-234180@lists.php.net to get a copy of this message | ||
Afternoon
Was wondering if there is an easier way to get returned variables into the $_SESSION rather than going through each one??
eg
$link_id = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Connection to $dbhost failed on verification section");
mysql_select_db($logindb, $link_id)
or die("Selection of database failed on verification section");
$query = "SELECT * FROM blah where blah = 'blah'";
$result = mysql_query($query) or die ("Query failed: " . mysql_error());
while ($line = mysql_fetch_object($result, MYSQL_ASSOC)) {
$id = $line->id;
$firstname = $line->firstname;
$surname = $line->surname;
$email = $line->email;
}
mysql_close($link_id);
$_SESSION["id"] = "$id";
$_SESSION["firstname"] = $firstname;
$_SESSION["surname"] = $surname;
$_SESSION["email"] = $email;
Any help here is appreciated....
Chris