Jump to content

postcode lookup


ldoozer

Recommended Posts

Hi all

 

I am trying to develop a small postcode lookup so taht people can type in their full postcode and hit go, and they are send to a page where they see the results to see if something is happening in their area.

 

The problem is I only want to query the first part of the postcode i.e. S10 or S1 and disregard the rest.

I have a script that will format the input from the user to a standard format (http://www.braemoor.co.uk/software/postcodes.shtml) but what i need to know is how to query there database form there:

 

Would it be something like:

 

$query = "SELECT * FROM tablename WHERE LEFT(PostCode, LENGTH(PostCode ) - 3 )IN('$postcode')";

 

 

Many thanks

Steve

Link to comment
https://forums.phpfreaks.com/topic/178455-postcode-lookup/
Share on other sites

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.