fezzik Posted November 10, 2006 Share Posted November 10, 2006 I need help with correctly rewriting the below script as a session variable, primarily the correct way to write $numbers[$id] as a session array:if (isset($numbers[$id])) { $numbers[$id] += $another_count;} else { $numbers[$id] = $another_count;} foreach($numbers as $key => $val) echo $key . ' : ' . $val . "<br />\r\n";Thank you for any assistance! Fezzik Quote Link to comment Share on other sites More sharing options...
Orio Posted November 10, 2006 Share Posted November 10, 2006 What do you exctly mean? Change the variable to a session variable?Instead of $numbers[$id] write $_SEESION[$id]. Dont forget to run session_start() at the begining.Orio. Quote Link to comment Share on other sites More sharing options...
fezzik Posted November 10, 2006 Author Share Posted November 10, 2006 Thanks for the response. I believe that $_SESSION[$id] is not correct. I need to keep the $numbers[$id] as an array. Quote Link to comment Share on other sites More sharing options...
toplay Posted November 10, 2006 Share Posted November 10, 2006 $_SESSION['numbers'][$i] = ... Quote Link to comment Share on other sites More sharing options...
fezzik Posted November 10, 2006 Author Share Posted November 10, 2006 Thanks! I just discovered this!Cheers,Fezzik Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.