i have this code to show the info window in google maps
var infoWindow = new google.maps.InfoWindow({
position: latlng,
content: 'Hello, world'
});
and i have a php code to retrieve the address from the database.
<?php
mysql_connect("localhost", "root", "root") or die (mysql_error ());
mysql_select_db("theaterdb") or die(mysql_error());
$strSQL =("SELECT address FROM theaters WHERE theater_name='" . mysql_real_escape_string($_POST['course']) . "'");
$rs = mysql_query($strSQL);
while($row = mysql_fetch_array($rs)) {
echo "<b>Theater Address:</b><br>";
echo $row['address'] . "<br /><br />";
}
mysql_close();
?>
Now i need to get the address from database to infowindow’s content field..how to do this? can anyone help me….thanks in advance.
Use
mysql_fetch_assoc()and assign$rowdatabase values:For a side note, you can try to move your code to PDO as
mysql_*functions are deprecated, check this nice tutorial.