0

The result is a blank screen.

php&Javascript code

<?php
$con = mysqli_connect($db_host,$db_user,$db_passwd,$db_name);

if(mysqli_connect_errno($con)){
  echo "no database  " . mysqli_connect_error();
}

mysqli_set_charset($con, "utf8");

$result = mysqli_query($con, "select * from Market");

$n = 1;
while($row = mysqli_fetch_array($result)){ ?>
  var positions = [
      {
          latlng: new daum.maps.LatLng(
            <?= $row['lat']; ?>, <?= $row['lon']; ?>
          )
      }
<?php $n++;
}
?>

Normal code when latitude and longitude are inserted without using mysql

var positions = [
    {
        latlng: new daum.maps.LatLng(33.450705, 126.570677)
    }
];

The error message is not displayed in the result window and a blank screen is displayed.

Hannah Oh
  • 39
  • 4

1 Answers1

0
  • Add this in the beginning of the your php code

ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

  • Make sure there is at least one row in Market table.
  • Add var_dump(mysqli_error($con)); after mysqli_query and make sure there is no error.