hi
i used for getting phone number
if the number is equal to or more than 10 digits then i get this below number everytimePHP Code:$phone = intval($_POST['phone']);
otherwise its fine for less than 10 digitsCode:2147483647
vineet
| SitePoint Sponsor |



hi
i used for getting phone number
if the number is equal to or more than 10 digits then i get this below number everytimePHP Code:$phone = intval($_POST['phone']);
otherwise its fine for less than 10 digitsCode:2147483647
vineet
Take a look at this: http://php.net/manual/en/function.ctype-digit.php
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget


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.
Bookmarks