Basic overview, 1) add a new textbox for 'name search'
2) create function that takes taht value and sends it to the server (much like the searchLocationsNear calls var searchUrl = 'phpsqlsearch_genxml_restaurant.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius; you have var searchUrl = 'phpsqlsearch_genxml_restaurant.php?q=' + escape(query); 3) modify the php script to check if a name is included, if it is search the name field, otherwise get the lat/long and search as per the tutorial. at the most basic you just do $sql = "... where name like '%".mysql_real_escape_string($_GET['q'])."%' "; which will work for single keywords. Otherwise investigate the full text search option in mysql . On 02/03/2009, Nathan <[email protected]> wrote: > > So, I ran through the API tutorial to create a store locator, and it > worked like a charm. I have a MySQL database with 1000 or so > locations, and using the API example, I have everything set up to > search by address, grab the locations from the database and show them > on a map. That works perfectly..... > > But now I want to add a field to search by name. > > The client is a vodka producer. They want people to be able to search > by location (give me the nearest liquor store that has the product) > but also by store name (hey, I live by Joe's Liquor store, do they > have it?). > > So, the name of the store is in the db, but how do I do a search by > it? I don't even know where to begin. > > Here's the page that works to find a location by address: > http://www.doublecrossvodka.com/locator/find_restaurants.php > > That page hits the > http://www.doublecrossvodka.com/locator/phpsqlsearch_genxml_restaurant.php > page > > Any ideas? > > Thank you so much. > > > > -- Barry - www.nearby.org.uk - www.geograph.org.uk - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
