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