sessions using database .. ci userguide .. i get an error |
[eluser]pendalpusher[/eluser]
I am trying to implement the sessions using database as described in the user guide http://ellislab.com/codeigniter/user-gui...sions.html is says the basic table is as follows Code: CREATE TABLE IF NOT EXISTS `ci_sessions` ( when i make the table this way .. i get this error Code: A Database Error Occurred obviously when i change the settings to the user_data field to allow null, it works. Is this an error within the user guide? or I am missing something and using this incorrectly? any help would be great. thanks, C
[eluser]WanWizard[/eluser]
In MySQL, you can't define a default for a TEXT field. And as it's also defined as NOT NULL, you'll get this violation when a new session is created (as you can see, the insert does not define the 'user_data' field). Remove the NOT NULL from the user_data field to solve this problem.
[eluser]pendalpusher[/eluser]
thanks. I just wanted to make sure i wasn't missing something before I moved on. I appreciate the confirmation. C
[eluser]InsiteFX[/eluser]
New Sessions table! Code: -- InsiteFX
[eluser]pmoroom[/eluser]
[quote author="InsiteFX" date="1309472004"]New Sessions table! Code: -- InsiteFX[/quote] I noticed you increased the size of user_agent. I had to do the same thing with FF 5 as the agent name was longer than the default.
[eluser]InsiteFX[/eluser]
I did not increase it the Reactor Core Team did, but they just documented it a couple of days ago. But even varchar(120) is to small for all user_agent strings IE will break it now. I think it should be varchar(255). InsiteFX
[eluser]pmoroom[/eluser]
Okay good I was going to post it today, but I won't now.
[eluser]osci[/eluser]
http://stackoverflow.com/questions/65492...string-get I believe the second answer (the accepted one) describes the length issue better. Also later on that post Quote:"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; YPC 3.2.0; SearchSystem6829992239; SearchSystem9616306563; SearchSystem6017393645; SearchSystem5219240075; SearchSystem2768350104; SearchSystem6919669052; SearchSystem1986739074; SearchSystem1555480186; SearchSystem3376893470; SearchSystem9530642569; SearchSystem4877790286; SearchSystem8104932799; SearchSystem2313134663; SearchSystem1545325372; SearchSystem7742471461; SearchSystem9092363703; SearchSystem6992236221; SearchSystem3507700306; SearchSystem1129983453; SearchSystem1077927937; SearchSystem2297142691; SearchSystem7813572891; SearchSystem5668754497; SearchSystem6220295595; SearchSystem4157940963; SearchSystem7656671655; SearchSystem2865656762; SearchSystem6520604676; SearchSystem4960161466; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Hotbar 10.2.232.0; SearchSystem9616306563; SearchSystem6017393645; SearchSystem5219240075; SearchSystem2768350104; SearchSystem6919669052; SearchSystem1986739074; SearchSystem1555480186; SearchSystem3376893470; SearchSystem9530642569; SearchSystem4877790286; SearchSystem8104932799; SearchSystem2313134663; SearchSystem1545325372; SearchSystem7742471461; SearchSystem9092363703; SearchSystem6992236221; SearchSystem3507700306; SearchSystem1129983453; SearchSystem1077927937; SearchSystem2297142691; SearchSystem7813572891; SearchSystem5668754497; SearchSystem6220295595; SearchSystem4157940963; SearchSystem7656671655; SearchSystem2865656762; SearchSystem6520604676; SearchSystem4960161466; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" Wow @.NET framework!!!! managed to reach 1500+ characters!!!!!! I lolled and I cried soooo much when I saw that. Thanks god I'm not programming in net!!!!
[eluser]InsiteFX[/eluser]
Ya, I use to program in C# .NET a few years ago. It's a pain in the A$$ InsiteFX
[eluser]pendalpusher[/eluser]
i did some digging through and at I think CI (2.0.2). is already truncating the user_agent to 50 chars. starts around line 316 in my system/libraries/Session.php Code: $this->userdata = array( So I would assume setting it back to varchar(50) would work correct? |
Welcome Guest, Not a member yet? Register Sign In |