Jump to content

Creating a search script based on location, cant use post/zip codes please help?


intrigue

Recommended Posts

Basically what i have is a table with vehicles and their location (counties) so say i have a vehicle
Honda Civic (Leicestershire)
Fiat Punto (Warwickshire)
Ford Fiesta (Derbyshire)
Honda Civic (Derbyshire)

well basically i want users to be able to search for a Honda civic in Leicestershire which works fine but then i want to have a button which says
"Search adjacent counties" which would mean searching Honda civic would find both the Leicestershire and Derbyshire ones as the two counties are adjacent.

Now the way we have thought about doing it is have a table which stores counties and adjacent counties maybe using a column called adjacent counties with id's in them and then when the search happens it finds all honda civics and then checks they are within the county and adjacent counties.

This seems like a strange way of doing it to me and there must be a better way but i cant think of it. I don't have any kind of post code ability as it looks as though we would have to pay for that kind of software.

Any advice would be most welcomed
Please help
matt
p.s. i know the explanation is not great so i will be more then happy to answer any questions to clarify things
Link to comment
Share on other sites

[code]<?php

$result = mysql_query("SELECT location FROM `vehicles_table` WHERE model='Honda Civic'");
while ($row = mysql_fetch_array($result))
echo $row['location']."<br>";

?>[/code]

Some changes need to be made with table/columns names.

Orio.
Link to comment
Share on other sites

That would show all honda civics with locations but it might show one in say a coutny in scotland which is 600 miles away so the user will not care about that car.

What i mean is only show cars within a certain distance. i.e. leicestershire and its surrounding areas.

[img]http://www.bigonions.net/example1.jpg[/img]

So i want to search everything in yellow, and would also be interested in black and red, but i dont care about blue as thats too far away.

Does that make more sense?

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