php simple math problem
Posted: Fri Oct 14, 2005 8:39 am
I have a "search by zipcode" form. when a visitor types in a zip code, it gets the range of 100 higher and 100 lower. Everything works good except when i use a zipcode with a zero in front.
So when i type in '01423'
the result of the search: 14301, 14253, 14201
Please help.
Here's the code:
So when i type in '01423'
the result of the search: 14301, 14253, 14201
Please help.
Here's the code:
Code: Select all
$wildcard = 01423;
$a = $wildcard - 100;
$b = $wildcard + 100;
//Getting
$c_query="SELECT * FROM user
WHERE zip
BETWEEN $a AND $b
ORDER by city ASC";