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\" /]
Link to comment
Share on other sites

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";
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.