yoki Posted October 21, 2008 Share Posted October 21, 2008 Hi, I'm rather new to setting up a MySQL database and was wondering if someone could suggest me a way of storing phone numbers. I'm planning to update my database with a .csv file which will contain the phone numbers in this format: 514,2544395 514,6549082 . . . I want to be able to search for a phone number by first selecting the area code in a dropdown and then entering the number in another field. Should I split the telephone number into two tables? One table for the area code and one for the telephone number? Any good suggestions would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/129409-solved-telephone-database/ Share on other sites More sharing options...
Barand Posted October 21, 2008 Share Posted October 21, 2008 I'd just store them as 5142544395 5146549082 You can find all the 514 numbers with SELECT phone FROM table WHERE phone LIKE '514%' Also, you can get the area codes for your dropdown with SELECT DISTINCT LEFT(phone, 3) as areacode FROM table You can format on output with something like this http://www.phpfreaks.com/forums/index.php/topic,208588.msg948466.html#msg948466 Quote Link to comment https://forums.phpfreaks.com/topic/129409-solved-telephone-database/#findComment-671143 Share on other sites More sharing options...
yoki Posted October 22, 2008 Author Share Posted October 22, 2008 Great!!! Thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/129409-solved-telephone-database/#findComment-671773 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.