Forum Moderators: coopster

Message Too Old, No Replies

mysql data type question

for US phone numbers

         

Sarah Atkinson

4:16 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



for a field that stores a phone # is their a specific type for phone numbers?
if so...What is it?
if not...What type should be used and how many char(do you include the (-))

RonPK

4:36 pm on Jun 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd say store them in a char or varchar field, otherwise mysql will perform math on them. You don't want to store 555-231-8107 as -7783 ;)

Dropping the - doesn't seem smart: you'll probably want them when printing the numbers after retrieving them from the db.

I'm not really into US numbers, but I suppose varchar(20) should give you plenty of storage space.

ramoneguru

9:06 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



If its just an input box then be wary of stuff like this:

(912)-332-4567 ext. 4568 Ask for Joan

Yeah I had someone input something like that once...insanity...

--Nick