![]() |
Session database not working, using cookies does - 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: Session database not working, using cookies does (/showthread.php?tid=18607) Pages:
1
2
|
Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]RJ[/eluser] Hello, I can't figure out why CI is not loading the default session cookie. Below is from my error log. Quote:DEBUG - 2009-05-12 17:54:25 --> Database Driver Class Initialized Here is my onscreen error: Quote:Error Number: 1364 I did recently switch to using database rather than cookies, and worked fine until this error appeared. any ideas why? the field "user_data" is not specified by me... NOTE: system works without database enabled now. Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]TheFuzzy0ne[/eluser] Have you extended the session class at all? Please post your database schema. Here's mine: Code: CREATE TABLE `ci_sessions` ( Does yours differ in any way? There is no default set for the userdata, but mine seems to work without that. Which database and storage engine are you running? Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]RJ[/eluser] differs only slightly. when i intially switched to db, had no problems and there are values stored in the db. now it wants to act up! screen shot of db layout attached. using mysql Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]TheFuzzy0ne[/eluser] I doubt the collation should make any difference, but it may be worth checking out. If it's imperative you use your existing collation, then you could probably just add a default value for that field, but I can't see why you should need to. It is strange that it worked, but then stopped working. Also, I'm still wondering whether or not you've extended the session class? Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]RJ[/eluser] damn, change coll to UTF8, nothing, same error. what i notice is the error occurs before even my first controller; and after the language file is loaded. Checking in the session library of CI I found this may be the root of error Code: $row = $query->row(); Now $this->userdata is set at the top and referenced through out, however the first instance of user_data is in the code above line2, line 217 in Session.php. any idea what triggers that and may be causing the error? Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]TheFuzzy0ne[/eluser] I'm sorry, but I don't understand what you mean. Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]RJ[/eluser] $this->userdata is set throughout the Session.php library. user_data or more specifically $row->user_data is initially declared on like 217. My error say there is no default value for user_data. trying to reverse engineer the problem back to it's source; but i'm stuck here. Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]TheFuzzy0ne[/eluser] What you are receiving, is a database error, and the database appears to be complaining that the userdata field has no default value (as the session class doesn't insert any userdata when the session is first created). I can only conclude that dropping the table, and recreating it from the schema I posted. It just doesn't make sense why else it would throw that error for you, and no-one else. Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]RJ[/eluser] This is my config settings Code: $config['sess_cookie_name'] = 'fw_session'; Same error # on new database using your setup (changed ci to fw) Quote:Error Number: 1364 any thoughts? Session database not working, using cookies does - El Forum - 05-12-2009 [eluser]TheFuzzy0ne[/eluser] It's starting to sound like your MySQL server may have one of the strict modes enabled - http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_trans_tables |