- Impact
- 2
Ok, I am in the process of developing a new site. The mysql database will contain thousands of records. Each record will contain a name, city, state, zip, phone number, ect.
Now, on the site, I want to have a search feature - where the user will enter the name and either the city & state, or just the zip code.
Obviously, once they begin their search, a page should be returned with all the same or similar names along with that names' address and all other info.
So we will be searching by name, city, state, and zip.
I am thinking i would need to use SELECT to search, but I have no idea really.
So my question is - How do I make this search feature on my site? How do I take the data the user entered in the search form, and use that to search the database and return accurate results? Like if someone enters 'dog' as the name ( i am just making stuff up here for examples sake) how do I make it return ONLY dog versus making the search return 'dogs' 'doggy' 'dog store' etc. And how do I make it return only the results for dog that are in the same city and state or zip? Also, how do retail store websites return locations that are close to the city you entered? Its like it knows how close or far apart the cities are! ... I need all this functionality on my site.
Any insight would be greatly appreciated!
Since my post was kinda long - basically I need to have the search functionality that like, bestbuy.com would have for their store locator.
Help please! or maybe you can direct me to some good tutorials. I know some php and mysql, so I should be able to figure this out, i just need some direction!
THANKS!
edit - oh yeah, i am also wondering if there is something i should know to really optimize my database for this type of searching. I just use phpmyadmin to administer and create my database.
Now, on the site, I want to have a search feature - where the user will enter the name and either the city & state, or just the zip code.
Obviously, once they begin their search, a page should be returned with all the same or similar names along with that names' address and all other info.
So we will be searching by name, city, state, and zip.
I am thinking i would need to use SELECT to search, but I have no idea really.
So my question is - How do I make this search feature on my site? How do I take the data the user entered in the search form, and use that to search the database and return accurate results? Like if someone enters 'dog' as the name ( i am just making stuff up here for examples sake) how do I make it return ONLY dog versus making the search return 'dogs' 'doggy' 'dog store' etc. And how do I make it return only the results for dog that are in the same city and state or zip? Also, how do retail store websites return locations that are close to the city you entered? Its like it knows how close or far apart the cities are! ... I need all this functionality on my site.
Any insight would be greatly appreciated!
Since my post was kinda long - basically I need to have the search functionality that like, bestbuy.com would have for their store locator.
Help please! or maybe you can direct me to some good tutorials. I know some php and mysql, so I should be able to figure this out, i just need some direction!
THANKS!
edit - oh yeah, i am also wondering if there is something i should know to really optimize my database for this type of searching. I just use phpmyadmin to administer and create my database.