If I enter the number 5094791727 into a ten digit int in MySQL using either MySQL or PHP and then go back and recall the number, it will have stored 2147483647.
Actually if I enter 509479172? (with the ? being a number 0-9) it will store 2147483647.
But ANY other number I enter it will store and recall correctly.
WHAT is with this and how do I store the number 5094791727 and why is my problem so specific to the number 5094791727?
That's because your number 5094791727 is outside the range of integer (INT) type. INT type has a range from -2,147,483,648 to 2,147,483,647 or 0 to 4,294,967,295 if using UNSIGNED attribute (which explains the number you keep getting).
If you store large number, change the column data type to BIGINT with this statement :
ALTER TABLE tbl_name CHANGE col_name col_name BIGINT(10)
or
ALTER TABLE tbl_name CHANGE col_name col_name BIGINT(10) UNSIGNED
Bookmarks