SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Wizard jumpthru's Avatar
    Join Date
    Apr 2000
    Location
    Los Angeles, California
    Posts
    1,008
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

    Thanks.

  2. #2
    SitePoint Zealot oodie's Avatar
    Join Date
    Jul 2000
    Location
    Misty Mountain
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

    Change tbl_name and col_name to your table and column name that you want to change. For reference of MySQL data type, look here http://www.mysql.com/documentation/m...n=Column_types

  3. #3
    SitePoint Wizard jumpthru's Avatar
    Join Date
    Apr 2000
    Location
    Los Angeles, California
    Posts
    1,008
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AHHHHH! Thank you so much.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •