Jump to content

post code search and surounding area option


Recommended Posts

Hi there

i want to be able to search for an exact post code and also for sorounding area.

for example the post codes are 3801 3802 3803 3804 3805 3806 3807 3809.

customer searchs for 3804 but i want to be able to bring up all other as well from 3801 to 3809.


i am going crazy [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
You could say use between option on your query
$postcodeid = 3804

// this will get you the whole number of 103 percent of the id your searching for
$MaxPCID = int($postcodeid * 1.03)

// this will get you the whole number of 97 percent of the id your searching for
$MinPCID = int($postcodeid * 0.97)


$querystring = "select * from table where (ID between $MinPCID and $MaxPCID) order by postcodeID";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.