Welcome Guest, Not a member yet? Register   Sign In
CI 1.7.3 databased backed sessions (`user_data` text NULL)
#1

[eluser]blasto333[/eluser]
A user is reporting an error with the default CI sessions table as described in the manual of:

Code:
CREATE TABLE `phppos_sessions` (
  `session_id` varchar(40) NOT NULL DEFAULT '0',
  `ip_address` varchar(16) NOT NULL DEFAULT '0',
  `user_agent` varchar(50) NOT NULL,
  `last_activity` int(10) unsigned NOT NULL DEFAULT 0,
  `user_data` text NOT NULL DEFAULT '',
  PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


A Database Error Occurred
Error Number: 1364

Field 'user_data' doesn't have a default value

INSERT INTO `phppos_sessions` (`session_id`, `ip_address`, `user_agent`, `last_activity`) VALUES ('8efeb8a2708af2ea799584ff50aa3c2f', '127.0.0.1', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) Ap', 1302002136)
--


Having them use:

Code:
CREATE TABLE `phppos_sessions` (
  `session_id` varchar(40) NOT NULL DEFAULT '0',
  `ip_address` varchar(16) NOT NULL DEFAULT '0',
  `user_agent` varchar(50) NOT NULL,
  `last_activity` int(10) unsigned NOT NULL DEFAULT 0,
  `user_data` text NULL,
  PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Seems to fix the problem. Is there anything wrong with having them have NULL data for user_data. (It seems to fix their problem)


Messages In This Thread
CI 1.7.3 databased backed sessions (`user_data` text NULL) - by El Forum - 04-19-2011, 11:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB