0

When I add a number beginning with 0 into my MySQL database, it automatically gets converted to a single digit. These are mobile numbers, so I need to keep it starting with 0.

2 Answers 2

3

Store phone numbers as strings, not integers. (related: Common MySQL fields and their appropriate data types )

Sign up to request clarification or add additional context in comments.

Comments

1

Try storing the numbers as varchars instead. When you retreive them from the database you could cast them using (int) if needed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.