I enter the data into mySQL database through a PHP script, but for some reason, when I check the database, all phone numbers have their first digit, so 0123456789 is displayed as 123456789 in the database, but if I change the data type from INT before TEXT, it will display correctly, I doubt very much that it will remain TEXT, although, as I am sure, this will lead to complications in the future, as the database application starts to become more complicated, here is the PHP code.
<?php
$gender = $_POST['gender'];
$first_name = $_POST['first_name'];
$second_name = $_POST['second_name'];
$id_number = $_POST['id_number'];
$home_number = $_POST['home_number'];
$cell_work = $_POST['cell_work'];
$email_address = $_POST['email_address'];
$curDate = date("Y-m-d");
mysql_connect ("server", "user", "pass") or die ('Error: ' . mysql_error());
mysql_select_db ("database");
$query = "INSERT INTO table (id,gender,first_name,second_name,id_number,home_number,cell_work,email_address,date) VALUES('NULL','".$gender."','".$first_name."','".$second_name."','".$id_number."','".$home_number."','".$cell_work."','".$email_address."','".$curDate."' )";
mysql_query($query) or die (mysql_error());
?>
Thanx in advance!
source
share