I apologize if this was already addressed previously, however my search netted 0 results... :\
I am trying to create list of $_SESSION variables (more like an array I guess) according to my MySQL search results, however they wouldn't carry over into any other pages unless I manually specified the names and values.
For example:
$query = "SELECT * FROM users WHERE userid='123'";
$blah = mysql_fetch_array(mysql_query($query));
foreach($blah as $key => $value) {
$_SESSION[$key] = $value;
}
Pretty simple, or so I thought. But it didn't work. I had to manually specify:
$_SESSION['first_name'] = $blah['first_name'];
$_SESSION['last_name'] = $blah['last_name'];
before it would work. 🙁
Any ideas on why this is?
Thanks in advance.