Web Design Forum: Storing phone numbers in a database. - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Storing phone numbers in a database. Rate Topic: -----

#1 User is offline   gigman7 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 64
  • Joined: 31-August 11
  • Reputation: 0

Posted 06 February 2012 - 08:22 PM

I am creating a user id for a web site and in the site, the user enters a phone number, only numbers, 10 digits. When they enter fewer digits, it stores the number fine but when they enter 10 digits, it saves the number 2147483647 no matter what they put in. What is happening here.
0

#2 User is offline   SniderDK 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 697
  • Joined: 01-November 08
  • Reputation: 88
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 07 February 2012 - 10:53 AM

hiya,

sounds like the data type of the col (asuming your using mysql)... try changing it from a int to a varchar
0

#3 User is offline   hodephdesign 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 129
  • Joined: 18-January 12
  • Reputation: 10
  • Gender:Male
  • Location:Cardiff, Wales
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 07 February 2012 - 11:24 AM

View Postgigman7, on 06 February 2012 - 08:22 PM, said:

I am creating a user id for a web site and in the site, the user enters a phone number, only numbers, 10 digits. When they enter fewer digits, it stores the number fine but when they enter 10 digits, it saves the number 2147483647 no matter what they put in. What is happening here.


I think it's the top end of the INT datatype holding you back. You might want to try BIGINT. And you might want to make it an 11-digit unsigned zero-fill while you're at it.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users