note 46620 deleted from ref.session by sean
| From: | sean@php.net | Date: | Sun, 17 Oct 2004 23:22:09 +0000 |
| Subject: | note 46620 deleted from ref.session by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78706@lists.php.net to get a copy of this message | ||
Note Submitter: bennettpr a t yahoo d o t com
----
It seems you can't programatically set session vars, but have to explicitly declare the name
and value. (php4.3.8 on win2k)
eg, this *doesn't* work (ie no session vars are assigned):
foreach($row as $key => $value)
{
$_SESSION["".$key.""] = $value;
}
but this will:
$_SESSION['username'] = $row['username'];
$_SESSION['address_1'] = $row['address_1'];
etc etc
shame, as populating a $_SESSION array from a db record would be much easier if it could be done
programatically....
----
Reason: bad code