0

Requirement: Read rows from a mysql database, where one column contains an address and a city, make the resulting address into a link to google maps, by passing the address for the location only as described in the following link: is there a way to pass arguments to google map's get directions functionality? php code shippet $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo''.$row['DAYTIME'].''.$row['MEETINGNAME'].' '.''.$row['ADDRESSCITY'].''.''.$row['BLDGNAME'].''; } ?> The above block of code sucefully creates a link to maps.google.com BUT I want to put $row['ADDRESSCITY'] between the "http://maps.google.com/?q= and the closing " I tried this:

'<a href="http://maps.google.com/?q='.$row['ADDRESSCITY'].'/a'">'

and no results are displayed, and no error message either. Thanks

Community
  • 1
  • 1

3 Answers3

1

Can you try to remove the quote " just after <a href="http://maps.google.com/?q=

nekiala
  • 450
  • 9
  • 21
0

Change the url to this.

echo'<tr><td>'.$row['DAYTIME'].'</td><td>'.$row['MEETINGNAME'].'</td><td>'.'<a href="http://maps.google.com/?q='.$row['ADDRESSCITY'].'">Google Maps</a>'.'</td><td>'.$row['BLDGNAME'].'</td></tr>';
maartenpaauw
  • 555
  • 2
  • 7
  • 20
0

Try this :

echo'<tr><td>'.$row['DAYTIME'].'</td><td>'.$row['MEETINGNAME'].'</td><td>'.'<a href="http://maps.google.com/?q="'.$row['ADDRESSCITY'].'"></a></td><td>'.$row['BLDGNAME'].'</td></tr>';
Neo
  • 696
  • 1
  • 14
  • 33