CodeIgniter Forums
Problem Storing an object in a session - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem Storing an object in a session (/showthread.php?tid=22246)



Problem Storing an object in a session - El Forum - 09-02-2009

[eluser]Oussama M Billah[/eluser]
Hello,

When I try to store an object in a session I get the following error:

Message: Object of class ShoppingCart could not be converted to string

Filename: libraries/Session.php

Line Number: 683

I tried the solution in the following thread:
http://ellislab.com/forums/viewthread/95690/#486198

but when i add the lines that check if the data is an object, when i click on the button that will call the given view nothing happends. It just reloads the same page.

any help?


Problem Storing an object in a session - El Forum - 09-02-2009

[eluser]brianw1975[/eluser]
Howdy,

You can't store an object like that, that's why most shopping carts store the cart info in the database as serialized data.