i am using this php code to retrieve lat and lon from MySQL database,the result values should be given as input to the google map.so when i run the query the output should go to google maps. as parameters how can i do this?
This is the php code.
mysql_select_db("theatdb", $con);
$result = mysql_query("SELECT Lat,Lon FROM theaters
WHERE theater_name='theater_name'");
while($row = mysql_fetch_array($result))
{
echo $row['theater_name'];
echo "<br />";
}
?>
This is the google maps code
function initialize() {
var latlng = new google.maps.LatLng(12.91869,77.594051);
var myOptions = {
zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
The php code is retrieving the lat and lon value i want to pass the result to google maps.how can i do that? anyone help m.. thanks in advance.
Use
mysql_fetch_assoc()to get associative array from your database since you are getting only one result: