dousi1994 2019-05-15 02:45
浏览 61

php语法错了吗? [重复]

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.

</div>
  • 写回答

1条回答 默认 最新

  • dongya5893 2019-05-15 03:05
    关注
    • 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.
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分