This is a good question and beneficial to others, so I'm adding it as a topic to the Maps API v3 group.
In your case, the situation is that as a user changes selections via custom map controls, the map data needs to be refreshed using content hosted in a SQL database. The problem is that the database is not directly accessible to the user, but is accessible by using your web server as a proxy. There are a lot of different ways to tackle this problem. I'm going to outline two of the more common solutions: - Different selections simply toggle one or more map overlays. This is the solution used on my map at http://search.missouristate.edu/map/ The custom map controls on the right simply toggle different KML Layers. Each KML file is actually generated dynamically from content hosted in a database. So for instance the page at http://search.missouristate.edu/map/kml/?layers=base simply queries the database for building outline and description information and outputs valid KML. On the map, the user checkbox simply calls KmlLayer.setMap to toggle the visibility of the layer. - Use custom written AJAX to return new map data as the user changes selections In this scenario, in response to user interaction you would make a javascript XMLHttpRequest call with the user selection parameters to a special PHP page on your server. This PHP page would query the database and output a JSON object with the data. In your map javascript, you would use the returned JSON object to make changes to your map. You would have to decide whether to somehow detect changed options and modify features currently on the map or whether to simply remove everything currently shown and then add all the data back. This solution is more technically involved than the Kml solution, but it gives you more direct control over the behaviors of the objects on your map. If you have never coded a solution like this, then I recommend that you use a framework like jQuery to alleviate many of the cross-browser details for you. Good luck. Chad Killingsworth Assistant Director of Web & New Media Missouri State University -----Original Message----- From: Victor Blaer [mailto:[email protected]] Sent: Wednesday, December 08, 2010 5:11 PM To: Killingsworth, Chad A Subject: Re: Awesome job on the map Hi Mr Killingsworth (awesome name btw) I'm attaching the two files. One is just the standard connection.php file. The other is a map, that queries my database, but I have to hardcode the criteria. I'd like to query the database and plot the map based off the user input taken from checkboxes. I've searched and searched the interweb but can't get anything working. The template I'm working off is from http://tips4php.net/2010/10/use-php-mysql-and-google-map-api-v3-for-displaying-data-on-map/ (live example http://tips4php.net/docs/google_maps_poi_php_mysql.php) The query statement is on line 74 and the forms on 107. ANY HELP appreciated and I promise to pay it back to the web! Thanks for getting back to me, appreciate it Victor -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
