Hi andrew, why not you generate longitude, latitude on the basis of store address and insert it when you add store. and on the search page just make xml file of mysql query result. after that read xml file here is the code.
<script src="http://maps.google.com/maps?file=api&v=2&key=abc" type="text/javascript"></script> <script type="text/javascript"> var iconBlue = new GIcon(); iconBlue.image = ' http://labs.google.com/ridefinder/images/mm_20_blue.png'; iconBlue.shadow = ' http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconBlue.iconSize = new GSize(12, 20); iconBlue.shadowSize = new GSize(22, 20); iconBlue.iconAnchor = new GPoint(6, 20); iconBlue.infoWindowAnchor = new GPoint(5, 1); var iconRed = new GIcon(); iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png '; iconRed.shadow = ' http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconRed.iconSize = new GSize(12, 20); iconRed.shadowSize = new GSize(22, 20); iconRed.iconAnchor = new GPoint(6, 20); iconRed.infoWindowAnchor = new GPoint(5, 1); function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(0, 0), 1); GDownloadUrl("./gmap.xml", function(data, responseCode) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); map.clearOverlays(); var sidebar = document.getElementById('sidebar'); var bounds = new GLatLngBounds(); for (var i = 0; i < markers.length; i++) { var id = markers[i].getAttribute("id"); var name = markers[i].getAttribute("name"); var address = markers[i].getAttribute("address"); var logo = markers[i].getAttribute("logo"); var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var marker = createMarker(id, point, name, address, logo); map.addOverlay(marker); var sidebarEntry = createSidebarEntry(id, point, name, address); sidebar.appendChild(sidebarEntry); bounds.extend(point); } map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); }); } } function createMarker(id, point, name, address, logo) { var marker = new GMarker(point); var html = "<div class='left' style='width:300px;'><div style='width:150px' class='left'><b><a href=view_store.php?sname="+id+">"+name+"</a></b><br/>" + address + "</div><div class='right' style='width:135px; margin-left:5px;'><img src='./strlogo/" + logo + "' height='100px' width='100px'/></div></div>"; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } function createSidebarEntry(id, point, name, address) { var div = document.createElement('div'); var html = "<b><a href=view_store.php?sname="+id+">"+name + "</a></b><br/>" + address; div.innerHTML = html; return div; } </script> On Wed, May 5, 2010 at 12:12 PM, Andrew Leach <[email protected] > wrote: > On May 4, 9:06 pm, dips045 <[email protected]> wrote: > > > > I have been following the 'Creating a Store Locator with PHP, MySQL & > > Google Maps' tutorial. I got it working however I have noticed that > > some of the locations don't appear when I type in a postcode. It's > > only with certain postcodes in the database not all of them. So if I > > type in a postcode I know is in the database with the longitude and > > latitude - no results appear. Can you tell me why this is happening? > > I think we're going to need a link to your page and examples of data > which doesn't work. > > -- > 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]<google-maps-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-api?hl=en. > > -- 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.
