Kiran Suthar
Kiran Suthar

Reputation: 72

codeigniter set multidimensional array in session

i am facing an issue to add multidimensional array to codeigniter session.

i want to store a multidimensional array result to session or any other that variable i used after my adding process i want use that variable.

also tried to store simple array to store in session and they works but in my array this is notworking so please help friends

Please check below for my array structure,

Thanks in advance!

Array
(
   [0] => Array
   (
       [user_id] => 11
       [fb_id] => 0
       [am_id] => 0
       [cm_id] => 
   )
)

Upvotes: 2

Views: 1981

Answers (1)

Ahmed Ginani
Ahmed Ginani

Reputation: 6650

Use serialize method before storing multidimensional array to session. It is the better idea for storing multi dimensional array to session as a string and you can access this whenever needed by unserialize method.

Upvotes: 3

Related Questions