Forum Moderators: coopster

Message Too Old, No Replies

Storing a Phone Number

Your experience storing this data...

         

ramoneguru

11:46 pm on Dec 29, 2005 (gmt 0)

10+ Year Member



Ok, so I need to store a phone number obviously and I'm having some trouble deciding how to do it.

See, some of these numbers have extensions, are international numbers, use letters for their number (like 1-800-567-FREE)

I'm wondering would it be best to strip out all characters like (), ext, -, A-zA-Z and any other non numeric character. Then just store it as a number like 18005674323 and parse as necessary when the user goes to view it? I can't decide....

So, is there an efficient way to do this or what?
--Nick

coopster

3:12 pm on Dec 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It depends on how you anticipate your user will want to store it and how you will edit it. I remember thinking through the same issue once and considering the same options you are and decided to store the data as CHAR. That way the end user could enter their phone number as words if they wanted.

ramoneguru

12:03 am on Dec 31, 2005 (gmt 0)

10+ Year Member



Yeah, that makes sense. If they put in hypens or parenthesis I'll just strip them out and store the char/number data.......Thanks.

--Nick