khan kaka Posted June 16, 2006 Share Posted June 16, 2006 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\" /] Quote Link to comment https://forums.phpfreaks.com/topic/12137-post-code-search-and-surounding-area-option/ Share on other sites More sharing options...
jvrothjr Posted June 16, 2006 Share Posted June 16, 2006 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"; Quote Link to comment https://forums.phpfreaks.com/topic/12137-post-code-search-and-surounding-area-option/#findComment-46410 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.