-4

I got an error like this :

Parse error: syntax error, unexpected end of file in D:\XAMPP\htdocs\spasial\lokasi.php on line 72

With this code below here:

    <html>
    <head>      
    <title>Latihan Google map</title>
    <style type='text/css'>
    #peta {
    width: 50%;
    height: 400px;
    } </style>
   <script type="text/javascript" src="http://maps.google.com/maps/api/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('spasial');

            $sql_lokasi="select id,nama,lat,lng
            from laswi";
            $result=mysql_query($sql_lokasi);
            // ambil nama,lat dan lon dari table lokasi
            while($data=mysql_fetch_object($result)){
                 ?>
         ['<?=$data->nama;?>', <?=$data->lat;?>, <?=$data->lng;?>],<?
            }
    ?>      

];

//Parameter Google maps
var options = {
  zoom: 12, //level zoom
  //posisi tengah peta
  center: new google.maps.LatLng(-6.924554, 107.627800),
  mapTypeId: google.maps.MapTypeId.ROADMAP
};

 // Buat peta di 
var map = new google.maps.Map(document.getElementById('peta'), options);
 // Tambahkan Marker 

  var infowindow = new google.maps.InfoWindow();

var marker, i;
 /* kode untuk menampilkan banyak marker */
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'
  });
 /* menambahkan event clik untuk menampikan
     infowindows dengan isi sesuai denga
    marker yang di klik */

  google.maps.event.addListener(marker, 'click', (function(marker, i) {
    return function() {
      infowindow.setContent(locations[i][0]);
      infowindow.open(map, marker);
    }
  })(marker, i));
  }
 };
 })();
 </script>
 </head>
 <body>    
 <div id="peta"></div>
 </body>
 </html>

So i already set the short_open_tag to On in php.ini file. So, what's the problem in this code ?

1 Answers1

-2
<?php
 //konfgurasi koneksi database 
  mysql_connect('localhost','root','');
  mysql_select_db('spasial');

        $sql_lokasi="select id,nama,lat,lng
        from laswi";
        $result=mysql_query($sql_lokasi);
        // ambil nama,lat dan lon dari table lokasi
        while($data=mysql_fetch_object($result)){
             ?>
     ['<?=$data->nama;?>', <?=$data->lat;?>, <?=$data->lng;?>],

     <?php // <-- here
        }
?>  
KoIIIeY
  • 493
  • 1
  • 7
  • 22