Issue
How do I tell phpmyadmin, MySQL to allow the first 0 in front of a phone number for example ? (Not a zero fill)
- When I try to put a zero in front of it (in phpmyadmin), it removes it automatically.
- When I submit my form number with the 0 specified in front of the number it doesn't add it.
Is there a workaround or something ?
Solution
The INT
datatype in mysql stores just that, an integer. As you would expect with the integer datatype in any programming language, the database engine trims off any leading zeros and rounds any decimal points, making it inappropriate for storing phone numbers.
If the number of digits in the phone number is always the same, use the datatype CHAR(length)
instead, or if it's not use the datatype VARCHAR(max_length)
. These will store the exact value entered rather than an integer value.
Answered By - Bad Wolf
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.