PDA

View Full Version : Google Maps and a MySQL Data


cocoonfx
03-06-2009, 10:39 AM
Hello Chaps


I have built a little database for a fit camp to update when the next training session is going to be. They enter a location i.e The Ladybridge, Bonehill Rd, Tamworth, B78 3HE, into the DB so people can do a search or added it to tom tom or what ever... and i thought it would be good if i could place a google map on the page and everytime the database is updated with a new Postcode it will automatically show the new location on Google maps.

Is this possible? My idea is as follows. I amend the google script and add some php to echo out my variable. Would this work? and is this the best way to do it?

Google original code (high lighted in red the location).

<iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=The+Ladybridg e,+Bonehill+Rd,+Tamworth,+B78+3HE&amp;sll=53.800651,-4.064941&amp;sspn=12.530974,28.300781&amp;ie=UTF8&amp;s=AARTsJ rO1mmbnqmMbM5ac-8V497jD3h-uA&amp;ll=52.62926,-1.701529&amp;spn=0.003907,0.006437&amp;z=16&amp;output=embed"></iframe><br /><small><a href="http://maps.google.co.uk/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=The+Ladybri dge,+Bonehill+Rd,+Tamworth,+B78+3HE&amp;sll=53.800651,-4.064941&amp;sspn=12.530974,28.300781&amp;ie=UTF8&amp;ll=52.62 926,-1.701529&amp;spn=0.003907,0.006437&amp;z=16" style="color:#0000FF;text-align:left">View Larger Map</a></small>

My version

<iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=The+Ladybridg e,+Bonehill+Rd,+Tamworth,+B78+3HE&amp;sll=53.800651,-4.064941&amp;sspn=12.530974,28.300781&amp;ie=UTF8&amp;s=AARTsJ rO1mmbnqmMbM5ac-8V497jD3h-uA&amp;ll=52.62926,-1.701529&amp;spn=0.003907,0.006437&amp;z=16&amp;output=embed"></iframe><br /><small><a href="http://maps.google.co.uk/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=<?php echo row['location"];?>&amp;sll=53.800651,-4.064941&amp;sspn=12.530974,28.300781&amp;ie=UTF8&amp;ll=52.62 926,-1.701529&amp;spn=0.003907,0.006437&amp;z=16" style="color:#0000FF;text-align:left">View Larger Map</a></small>

davidj
03-06-2009, 06:40 PM
as you can see

The+Ladybridge,+Bonehill+Rd,+Tamworth,+B78+3HE

As you can see the query string above uses a + to delimit the string

im guessing you need to emulate this format