2
votes

A Database Error Occurred Error Number: 1364

Field 'user_data' doesn't have a default value

INSERT INTO ci_sessions (session_id, ip_address, user_agent, last_activity) VALUES ('9016ab41f90dc82a4047cf3d7d15c3ae', '0.0.0.0', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/53', 1336546808)

Filename: C:\xampp\htdocs\tutecircle\system\database\DB_driver.php

Line Number: 330

2
so what are we supposed to do , without seeing your table structure ? - Satya

2 Answers

2
votes

the session table looks like this:

CREATE TABLE IF NOT EXISTS  `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(120) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id),
KEY `last_activity_idx` (`last_activity`)

);

The user_data field must have a value. Otherwise edit the column to accept a null value.

2
votes

Change the user_data field from "NOT NULL" to "ALLOW NULL".

ALTER TABLE ci_sessions MODIFY user_data text DEFAULT NULL;

This should reset it's default to "ALLOW NULL", allowing you to insert a record without a value for user_data