Im trying to enter a phone number into my database, the column is set as varchar(15) and inside phpmyadmin it will accept a phone number with a leading 0 (07712123123 for example).
In my PHP script i have the variable $contactNo which is a string containing 07712123123
but when I use my prepared statement to input the data into the database the leading zero is removed. How can I stop this?
// Insert data into customer_accounts
if($stmt = $mysqli -> prepare("INSERT INTO customer_accounts (username, password, firstname, lastname, email, number) VALUES (?,?,?,?,?,?)")) {
$stmt -> bind_param("ssssss", $username, $password, $firstname, $lastname, $emailAddress, $contactNo);
$stmt -> execute();
$stmt -> close();
}
I have echo'd out the variable before and after the statement and the 0 is there so it must be removed as its put into the database. I'm new to prepared statements and I cant figure out what to do to fix it.
Thanks!