Jump to content

SQL postcode search


ldoozer

Recommended Posts

Hi all, I am trying to extend my search criteria on my site. the site uses php and a mysql database.
I have a field called postcode which contains postcodes such as:
S1 2RB
S6 3RK
S11 7AB

I have tried to query using the LIKE function ie:
query = SELECT * FROM Activities WHERE ActDesc LIKE '%tennis%' AND PostCode LIKE 'S1%';

However this returns both "S1 2RB" and "S11 7AB"

is it possible within the query to differeciate between the two?

Any help would be great.

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