intrigue Posted November 1, 2006 Share Posted November 1, 2006 Basically what i have is a table with vehicles and their location (counties) so say i have a vehicleHonda 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 welcomedPlease helpmattp.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 https://forums.phpfreaks.com/topic/25788-creating-a-search-script-based-on-location-cant-use-postzip-codes-please-help/ Share on other sites More sharing options...
Orio Posted November 1, 2006 Share Posted November 1, 2006 [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 https://forums.phpfreaks.com/topic/25788-creating-a-search-script-based-on-location-cant-use-postzip-codes-please-help/#findComment-117745 Share on other sites More sharing options...
intrigue Posted November 1, 2006 Author Share Posted November 1, 2006 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 https://forums.phpfreaks.com/topic/25788-creating-a-search-script-based-on-location-cant-use-postzip-codes-please-help/#findComment-117748 Share on other sites More sharing options...
Orio Posted November 1, 2006 Share Posted November 1, 2006 You'll need to have another table with distances...Orio. Link to comment https://forums.phpfreaks.com/topic/25788-creating-a-search-script-based-on-location-cant-use-postzip-codes-please-help/#findComment-117750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.