Welcome Guest, Not a member yet? Register   Sign In
Update session data with new values but keep old ones
#1

[eluser]PHP Creative[/eluser]
Hi there

I have the following code. It updates the session data with the an array from the table.

Code:
$this->db->select('ID');        
        $this->db->from('FoodTable');
        $this->db->where('Food',$this->input->post('food'));    
        $query = $this->db->get();
        
        

        
            $data = array(
                   'FoodID'  => $query->result_array()
               );

            $this->session->set_userdata($data);

What I want to do is keep the old values and add the new ones to the session data. For example a user comes along, searches for something, adds to the session, then searches for another thing. Both searches are included in session so I can display in a table.

The above code only keeps the new session and not the old data as it is overwritten.

Any help or advice would be much appreciated.

Thanks a millon


Messages In This Thread
Update session data with new values but keep old ones - by El Forum - 10-11-2010, 03:36 PM
Update session data with new values but keep old ones - by El Forum - 10-11-2010, 06:59 PM
Update session data with new values but keep old ones - by El Forum - 10-12-2010, 02:12 AM
Update session data with new values but keep old ones - by El Forum - 10-12-2010, 06:26 AM
Update session data with new values but keep old ones - by El Forum - 10-12-2010, 07:43 AM
Update session data with new values but keep old ones - by El Forum - 10-12-2010, 04:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB