This is a discussion on Using Arrays with $_SESSION within the PHP Language forums, part of the PHP Programming Forums category; I'm really confused on how to store arrays in a $_SESSION. Right now to access an array I basically ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm really confused on how to store arrays in a $_SESSION.
Right now to access an array I basically do this: $lc = $_SESSION["cart"]; $lc[$item] = 1; (plus some other manipulative code) $_SESSION["cart"] = $lc; Is there a better way to do this? I can't seem to figure out a proper way to include the array index inside the same line as $_SESSION (such as $_SESSION["cart($item)"]. -- - Michael J. Astrauskas |
|
|||
|
Michael J. Astrauskas wrote:
>I'm really confused on how to store arrays in a $_SESSION. > >Right now to access an array I basically do this: > > $lc = $_SESSION["cart"]; > > $lc[$item] = 1; > (plus some other manipulative code) > > $_SESSION["cart"] = $lc; > >Is there a better way to do this? I can't seem to figure out a proper >way to include the array index inside the same line as $_SESSION (such >as $_SESSION["cart($item)"]. $_SESSION["cart"][$item] = 1; (and other manipulative code) -- I have a spam filter working. To mail me include "urkxvq" (with or without the quotes) in the subject line, or your mail will be ruthlessly discarded. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|