What is the issue with 10 digit mobile no data in mysql?

前端 未结 3 877
半阙折子戏
半阙折子戏 2021-01-15 13:38

I made a table for storing contact record of user of my website. It also contains a 10 digit mobile no.

Table structure is like this:

CREATE TABLE co         


        
3条回答
  •  既然无缘
    2021-01-15 13:47

    The maximum value for an INT in MySQL is 2147483647 (or 4294967295 if unsigned), according to the MySQL documentation. If your value exceeds this limit, you integer will overflow, hence the not-that-random value.

    Also, INT is not the best solution to store phone numbers. You might lose leading zeros if they are one or more. Also, international phone numbers start with a + sign. Consider using a VARCHAR. This will end up using more space in the database, but will provide more consistency.

提交回复
热议问题