Jump to content


Photo

INT Field displaying strange results


  • Please log in to reply
3 replies to this topic

#1 leolanksford

leolanksford
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 20 October 2006 - 01:24 PM

Hi all,

I have a table which stores phone numbers amongst other details, currently the "phone" field is set up as: INT(20), Null = Yes, Default = 0

I recently tried to add the number '07000446639' to the db, but when i do this the db changes it to '2147483647'

Would any have any idea why it would be doing this?

Any help would be great,

Many thanks

Leo

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 October 2006 - 04:13 PM

Maybe I don't know what you mean be "add the number to the db"?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 leolanksford

leolanksford
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 20 October 2006 - 04:26 PM


What i was tying to say was that when i add the number 07000446639 into the column 'PhoneNumber' for a specific record, the db changes what i have entered to '2147483647'

i have tried entering the number without the 9 at the end and it works fine, but as soon as i add the 9 the db changes the whole number to 2147483647



#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 October 2006 - 04:36 PM

Two things: first, it sounds like it might be too large, though this shouldn't be an issue for INT; second, if you want to keep that leading zero, you'd have to use ZEROFILL or switch to a CHAR column, which I would recommend anyway, since you can't do math with this field.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users