Each time i try storing the id 1008218499200959 or any other 'long' int value to the database it's stored as 2147483647 and i have the data length set to 20 so the length shouldn't have been the problem i guess.
Is this a CodeIgniter or database issue?
I later fixed it by changing the data type to varchar but i'll still like to know why it behaves that way. Thank you.
applicantsCREATE TABLE IF NOT EXISTS `applicants` (
`id` int(20) NOT NULL,
`first_name` varchar(20) NOT NULL,
`last_name` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;`
The problem is with MySQL based on the id type you have defined. The largest int value is 2147483647. Check out their docs: https://dev.mysql.com/doc/refman/5.5/en/integer-types.html
Other options:
(see https://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html for more details).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With