Wednesday, 18 September 2013

How to Assign an array value to session variable in zend framework

How to Assign an array value to session variable in zend framework

I am trying to create a session variable and assign values in an array to
this session variable. how can i do that. i am creating like below but i
cannot get to it is functioning at all.
$post = Zend_Controller_Front::getInstance()->getRequest()->getParam('key');
$searches = new Zend_Session_Namespace('searches');
$parthis= $searches->partssearched;
if(is_array($parthis)){
$parthis->toArray();
} else {
$count= sizeof($parthis)."<br>";
if ($this->rows ) {
if ($count==0) {$parthis[0]=$post;}
//$searches[$count]=$this->rows;
echo $parthis[0]."HERE";
} else {
$parthis[$count]=$post;
foreach($parthis as $hist) {
echo $hist;
}
}
}
$this->rows are coming from the controller and it is carrying database
query results.
What i am trying to do here is i want to store the Get value into a
session variable carrying it as an array.
Should be like $parthis= array (value1, value2, value3); and every time
user pass a value in url, it should add upto it.
Thank you

No comments:

Post a Comment