![]() |
session set userdata, large multi-dimensional arrays - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: session set userdata, large multi-dimensional arrays (/showthread.php?tid=36828) |
session set userdata, large multi-dimensional arrays - El Forum - 12-15-2010 [eluser]bonatoc[/eluser] Hi, Just posting this for newbies like me, I thought it might help. I did not understand why a big multi-dimensional array would not be stored. I was going crazy, because when doing a Code: // GOOGLE MAPS API FULL RESPONSE - BIG ARRAY ... the big array showed up ! So I assumed the big array was correctly stored into userdata. But then, when checking on other controller/views, $this->session->userdata was NOT containing 'latest_google_response'. When you're using ci sessions relying only on cookies, It seems in fact that the 4KB limit is pretty easy to bump into. Using ci sessions relying on database solved it. Here's what I use on : application/config/config.php : Code: |-------------------------------------------------------------------------- Hope it helps someone. session set userdata, large multi-dimensional arrays - El Forum - 12-15-2010 [eluser]InsiteFX[/eluser] The database session will only hold 64kb, you can raise this by changing the user_data field to either mediumtext or longtext. InsiteFX session set userdata, large multi-dimensional arrays - El Forum - 12-16-2010 [eluser]smilie[/eluser] It all says nicely in the user manual: "Note: Cookies can only hold 4KB of data, so be careful not to exceed the capacity. The encryption process in particular produces a longer data string than the original so keep careful track of how much data you are storing." Cheers, Smilie session set userdata, large multi-dimensional arrays - El Forum - 12-20-2010 [eluser]poopants[/eluser] Hi, I bumped into the same problem. Your solution did just the trick with my multidimensional session array. The only left to do was to add the new table to the db. Just for convenience, I'll post the sql from the user_guide again. Now everything one needs to know, is on the same page ![]() Code: CREATE TABLE IF NOT EXISTS `ci_sessions` ( thanks everyone ! |