douou1891 2014-03-26 15:22
浏览 100

如何准确验证数据库中的电话号码? [关闭]

We are building an app that needs to check which contacts in your address book are already members of our app. We have a MySQL table with user information. This table has the phone numbers of all existing members with country code.

We could easily perform a MySQL IN statement to match all phone numbers with our database but, the issue lies in how people store contacts in their address book. Some people store phone numbers with country codes and some without. How do we match these correctly?

We could also match with usernames but, our needs specifically is to search by phone number.

  • 写回答

1条回答 默认 最新

  • dtc99987 2014-03-26 15:53
    关注

    The national conventions for writing telephone numbers vary by country.

    And hence, it would be a better option to include country, along with phone number in search criteria.

    And if you are storing phone numbers in country specific convention format like:

    +--------+-----------+--------------------+----------------------------------------------------+
    | India  | Land Line | +cc-(0)AAA-BBBBBBB | AAA - STD, and BBBBBBB - phone number              |
    | India  | Mobile    | +cc-AAAAA-BBBBB    | AAAAA - STD, and BBBBB - phone number              |
    | India  | Toll Free | 1-800-123456       | 10 digit number can be called from anywhere        |
    +--------+-----------+--------------------+----------------------------------------------------+
    | USA    | General   | (NPA) NXX-XXXX     | NPA - area code, and NXX-XXXX - subsccriber number |
    +--------+-----------+--------------------+----------------------------------------------------+
    

    then, you can't just search by phone number.

    It would be more convenient to search country specific numbers.

    If you still want to search by phone number only, you may need to remove the country specific formats and then perform a comparison on phone numbers only for either partial or full match. For matched numbers you may require to return both country code or name and phone number.

    评论

报告相同问题?

悬赏问题

  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单