This question already has an answer here:
- PHP parse/syntax errors; and how to solve them? 17 answers
- Reference - What does this error mean in PHP? 34 answers
i was check all but i am confused for mixing this code with PHP and HTML , Parse error: syntax error, unexpected end of file
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="jquery.js"></script>
<script type="text/javascript">
(function() {
window.onload = function() {
var map;
var locations = [
<?php
//konfgurasi koneksi database
mysql_connect('localhost','root','');
mysql_select_db('candralab-map');
$sql_lokasi="select idlokasi,lat,lon
from lokasi ";
$result=mysql_query($sql_lokasi);
// ambil nama,lat dan lon dari table lokasi
while($data=mysql_fetch_object($result)){
?>
['<?=$data->idlokasi;?>', <?=$data->lat;?>, <?=$data->lon;?>],
<?
}
?>
];
var options = {
zoom: 12, //level zoom
//posisi tengah peta
center: new google.maps.LatLng(-7.8008, 110.380643),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('peta'), options);
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: 'icon.png'
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
var id= locations[i][0];
$.ajax({
url : "get_info.php",
data : "id=" +id ,
success : function(data) {
$("#info").html(data);
}
});
}
})(marker, i));
}
};
})();</script>
can u find the missing part ?because mixing PHP and HTML is confusing, plese help me for fix this code...
</div>