Using Arrays with $_SESSION

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-04-2003
Michael J. Astrauskas
 
Posts: n/a
Default Using Arrays with $_SESSION

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

Reply With Quote
  #2 (permalink)  
Old 10-04-2003
Pedro
 
Posts: n/a
Default Re: Using Arrays with $_SESSION

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.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:42 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0