开发者

database backed session codeigniter 1.7.3 errors

开发者 https://www.devze.com 2023-02-22 18:17 出处:网络
I am using databased backed sessions for codeigniter 1.7.3 and it appears some users are getting the error:

I am using databased backed sessions for codeigniter 1.7.3 and it appears some users are getting the error: 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)

I had one of the users try to fix it by using version 2's recommended settings, but he said that didn't work so I had him try making the column nullable and that seemed to work. (What seems to work)

What are your thoughts/opinions on what to do? (I have a pretty large user based and I don't want to mess them up)

Recommended Code ignitor settings (version 1.7.3)

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; 

Recommended Code ignitor settings (version 2)

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 CHA开发者_开发百科RSET=latin1; 

What seems to work

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; 
0

精彩评论

暂无评论...
验证码 换一张
取 消