Is session->userdata supposed to return an array? - 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: Is session->userdata supposed to return an array? (/showthread.php?tid=33167) |
Is session->userdata supposed to return an array? - El Forum - 08-17-2010 [eluser]Unknown[/eluser] Code: $id = 1; Is session->userdata supposed to return an array? - El Forum - 08-18-2010 [eluser]WanWizard[/eluser] If I use that same code here, I get "int 1" returned. The CI session library doesn't convert data, and it certainly doesn't create objects. Are you using a custom session library? Is session->userdata supposed to return an array? - El Forum - 08-18-2010 [eluser]Unknown[/eluser] No custom library. Just the default one, autoloaded. Oh my, I've given false information in the first post. Apparently the array originates straight from the database. Code: $query = $this->db->query("SELECT id FROM users WHERE user = 'asd'"); I'm brand new to CI, so I might be oblivious about correct syntax etc. Any ideas? Is session->userdata supposed to return an array? - El Forum - 08-18-2010 [eluser]WanWizard[/eluser] See the user guide. $query->result() returns an array of objects, one for each record in the resultset. You should be doing something like Code: $query = $this->db->query("SELECT id FROM users WHERE user = 'asd'"); |