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
https://forums.phpfreaks.com/topic/27375-sql-postcode-search/
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.