El Forum
07-05-2007, 04:41 PM
[eluser]Unknown[/eluser]
Hello,
I'm using CI 1.5.3, PHP 5.2.3 and MySQL 5.0.37. I have a table with the following structure:
When I use scaffolding and try to insert a record (leaving an INT field "empty"), I get a Database error:
I did some research and it appears that I can just edit the MySQL my.ini file and remove "STRICT_TRANS_TABLES" from sql-mode...but I wanted to know if there were any other options. I don't know that everyone normally can edit the MySQL my.ini file and it appears that the issue is cause by the scaffolding sending a '' instead of a null.
Any thoughts?
Hello,
I'm using CI 1.5.3, PHP 5.2.3 and MySQL 5.0.37. I have a table with the following structure:
Code:
CREATE TABLE `client` (
`id` int(10) NOT NULL auto_increment,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`address_1` varchar(75) NOT NULL,
`address_2` varchar(75) NOT NULL,
`city` varchar(50) NOT NULL,
`state` char(2) NOT NULL,
`zip` int(9) default NULL,
`phone` int(10) default NULL,
`cell` int(10) default NULL,
`email` varchar(255) NOT NULL,
`company` varchar(75) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
When I use scaffolding and try to insert a record (leaving an INT field "empty"), I get a Database error:
Code:
An Error Was Encountered
Error Number: 1366
Incorrect integer value: '' for column 'zip' at row 1
INSERT INTO client (first_name, last_name, address_1, address_2, city, state, zip, phone, cell, email, company) VALUES ('xxx', 'xxx', '', '', 'xxx', 'CA', '', '', '', '[email protected]', '')
I did some research and it appears that I can just edit the MySQL my.ini file and remove "STRICT_TRANS_TABLES" from sql-mode...but I wanted to know if there were any other options. I don't know that everyone normally can edit the MySQL my.ini file and it appears that the issue is cause by the scaffolding sending a '' instead of a null.
Any thoughts?