Re: Store array as Session Variable

From: Date: Tue, 29 Jul 2003 16:19:13 +0000
Subject: Re: Store array as Session Variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157324@lists.php.net to get a copy of this message
Hi Try this $_SESSION[my_session] = array("item_1" => "Some Value" , "item_2" => "Some Value2" , "item_3" => "Some Value3"); This allow s you to store the array in the session Pradeep DSouza Naharonline.com ----- Original Message ----- From: "Pushpinder Singh Garcha" <pgarcha@adelphia.net> To: "CPT John W. Holmes" <holmes072000@charter.net> Cc: <php-general@lists.php.net> Sent: Tuesday, July 29, 2003 1:00 AM Subject: Re: [PHP] Store array as Session Variable > $details is empty !! > > Thanks > --Pushpinder > > > On Monday, July 28, 2003, at 03:31 PM, CPT John W. Holmes wrote: > > > $details is an array (just like $company_name was). Try to view > > print_r($details); and see what you get. > > > > ---John Holmes... > > > > ----- Original Message ----- > > From: "Pushpinder Singh Garcha" <pgarcha@adelphia.net> > > To: <php-general@lists.php.net> > > Sent: Monday, July 28, 2003 3:18 PM > > Subject: [PHP] Store array as Session Variable > > > > > > hello All, > > > > I am trying to store an array as a session variable. > > > > while ($row = mysql_fetch_array($result)) > > { > > if ( !is_array($company_name) ) $company_name = array(); > > array_push($company_name, $row['company']); > > > > // try to register session variable > > $_SESSION['link'] = $company_name; > > > > } > > > > > > Now when I try to access this session variable in another file...I am > > getting a junk value.I am not sure if I am getting this right. > > > > $details = $_SESSION['link']; > > echo "LINK: ".$details."<br>"; > > > > > > Can some one fill me in on this. Appreciate it ! Thanks in advance. > > > > --Pushpinder Singh > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.general (#157324) next »