Allow number to start with ZERO when stored in mysql integer field

EzzDev picture EzzDev · May 7, 2010 · Viewed 34.3k times · Source

I need to store phone numbers starting with 0 but whenever i try to store this in MySql table the starting ZERO is removed because no number start with Zero actually.

How to solve this issue? Do I need to change the field type from Integer to another type?

Answer

devasia2112 picture devasia2112 · Jan 17, 2011

change data type to unsigned-zerofill whatever you are using, float, int, decimal(6,2)... only edit the field to unsigned-zerofill