hi
i used for getting phone number
$phone = intval($_POST['phone']);
if the number is equal to or more than 10 digits then i get this below number everytime
2147483647
otherwise its fine for less than 10 digits
vineet
hi
i used for getting phone number
$phone = intval($_POST['phone']);
if the number is equal to or more than 10 digits then i get this below number everytime
2147483647
otherwise its fine for less than 10 digits
vineet
Take a look at this: http://php.net/manual/en/function.ctype-digit.php
The problem you are having is the phone number exceeds the maximum value an integer can hold. A PHP integer can hold a value up to 2147483647.
You will need to use the is_numeric() or the ctype_digit() function to check if you were given a numeric value.
hi
what should be the column type in database for storing 10 digit numeric phone number
vineet
I personally always use varchar(X) where X is the number of characters you want stored. The reason being, I don’t want any leading zeros truncated.