Skip to main content
Participant
February 24, 2009
Question

post code search

  • February 24, 2009
  • 1 reply
  • 376 views
Bear with me...

I have a MySQL table which contains a list of cities, the URL of their corresponding image (ie a pic of that city) and the first letters of the post codes of that city (eg CF for Cardiff, B for Birmingham).

I have a search form which allows users to search for businesses by name and city or postcode.

I want to insert a dynamic image of the city searched for. So far, if the user types "Cardiff" or "cardiff" or "car", the correct image appears. If he types "CF" or "cf", he gets the right image. BUT if he types "CF24 4AA", he gets nothing.

In the query advanced panel the SQL looks like this:

SELECT *
FROM cities
WHERE cityforpic LIKE TownPic% OR PostCodeStart LIKE PostC%

Both variables TownPic and PostC are text, GET their data from the same text field, and are set to default value -1.

So what am I doing wrong???????

I am wellllllll past my deadline on this one, so any URGENT help greatly appreciated and will be rewarded with cyber-cocoa and biscuits! 😜
This topic has been closed for replies.

1 reply

Inspiring
February 24, 2009
Hi mate,
I have had major problems in this field too.

I found this on the net:
http://www.pc-i.co.uk/postcode-distance.php

I hope it helps.
Rabaab_mAuthor
Participant
February 24, 2009
thanks for the effort but not what I need... basically, my SQL works if the user ONLY types the first letters of the postcode, but not if they use the numbers as well.

(rapidly losing my hair...)