MySQL truncates my first zeros data

2012-05-11T20:11:01

I have a MySQL column "phone" , and when data comes from my php form, if there's a zero at the beginning, it will disappear in the table, for example : "06719823" becomes "6719823"

I first though it was a problem from php, cause I'm using mysql_real_escape_string(), but then I tried to modify the SQL field directly on phpmyadmin, and I can't add a first 0, it always delete it.

Colonne     Type     Interclassement    Attributs   Null    Défaut  Extra
phone       int(10)                                 Oui     NULL    

What's wrong ? Should I assign an "interclassement" utf8_general_ci ?

Copyright License:
Author:「pimarc」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/10551083/mysql-truncates-my-first-zeros-data

About “MySQL truncates my first zeros data” questions

I have a MySQL column "phone" , and when data comes from my php form, if there's a zero at the beginning, it will disappear in the table, for example : "06719823" becomes "6719823" I first though...
Postgres (V11.3, 64bit, Windows) truncates trailing zeros for timestamps. So if I insert the timestamp '2019-06-12 12:37:07.880' into the table and I read it back as text postgres returns '2019-06-...
This is a followup to an earlier question: MySQL how to specify string position with LOAD DATA INFILE When loading a long line into the temp table's TEXT field, it truncates it to 256 characters. ...
I'm using REPLACE in a MySQL statement to update a text field. Right now I'm just running it as a SELECT vs. the original REGEX to make sure it works e.g.: Select Regex, Replace(Replace(Proper(Reg...
I am trying to import an excel file into SAS using SAS EG Import wizard. I have a field X with type char4. But, it has numeric data. e.g. 1101 During import, SAS truncates leading zeros although th...
I am trying to export data into a csv file but my leading zeros are getting chopped... I CANNOT modify the data after it is pulled so LPAD is not an option. Also, ID is not a set length... it could...
I have a table that contains a column tos_id which is of data type bigint(20) When saving a sample like below from my PHP/MySql app, I see following data: tos_id in HTTP Network tab: 9112884569788786
I've created a view which uses GROUP_CONCAT to concatenate results from a query on products column with data type of 'varchar(7) utf8_general_ci' in a column named concat_products. The problem is t...
I've created a view which uses GROUP_CONCAT to concatenate results from a query on products column with data type of 'varchar(7) utf8_general_ci' in a column named concat_products. The problem is t...
I've created a view which uses GROUP_CONCAT to concatenate results from a query on products column with data type of 'varchar(7) utf8_general_ci' in a column named concat_products. The problem is t...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.