store array into session variable and get it back later
| From: | Alain Roger | Date: | Wed, 01 Oct 2008 10:31:44 +0000 |
| Subject: | store array into session variable and get it back later | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-281268@lists.php.net to get a copy of this message | ||
Hi,
i have a 2 dim array defined as following:
class CBreadcrumb
> {
> // array holding the complete Breadcrumb
> var $crumb = array();
>
> /*
> * Constructor
> */
> function CBreadcrumb()
> {
>
> }
>
> /*
> * Add new stage
> */
> function Add($name, $link, $id)
> {
> array_push($this->crumb,array('name' => $name, 'link' =>
> $link,
> 'id' => $id));
> }
> }
>
and its instance :
$bc = new CBreadcrumb();
>
> // filling the instance
>
> $bc->Add('Home',"https://www.myweb.com/framework/",0);
> $bc->Add('Language',"Ã|&
> ‡iÂIP.=-6Ëhttps://www.myweb.com/language/",1);
>
> // session must be started to store this breadcrumb
> $_SESSION['bc']=$bc;
>
later on i try to use the content of this array, bt without success.
Here is what i do:
$bci = array($_SESSION['bc']);
> array_push($bci,$_SESSION['bc']);
>
> foreach($bci as $key=>$value)
> {
> echo "bci : ".$bci[$key]['name'];
> echo "<br/>";
> }
>
how can i get the 'name' value for each row in this session stored array ?
thx.
--
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008