On Wed, 29 Jun 2005 01:01:18 -0700, nortelsale wrote:
i have a site that allow people to post for sale, for rent info, I want to
have advanced search function that can search all the posting (in my site)
by zip code, and by certain miles say 10, 20 miles within a zip code?
My site is written in PHP with a mySQL database.
I take it you already know how to search with select.
select* from mytable where zip = ????;
For such a site relying on searches of this kind it is worth having
multiple indexes set on the table, almost per field. Increasing the
number of indexes reduces data writes speed (hardly noticeable on a web
application), but increases speed on searches.
The mileage search, they are tables available, I haven't worked on a US
one, but the BT one was readily available on their web site for UK
postcode areas. I suspect the US postal services has one too.
Ours works in areas using the first part of the code, ex DH24 for an area
in Durham and has the distance to each other area (like one of those
triangular distance maps). The one I saw was already in the form of a
lookup table.
I remember also someone talking at that time of setting it as a matrix,
which would make finding surrounding areas easy (i.e. just subtract from
the matrix those that are not in distance).