php无法显示,感觉是sql的错但是找不到

这是我的代码,在查询http://localhost/business/php/productList.php?class=first&id=1时一直显示[]

<?php
   include "server.php";
   $class = $_GET['class'];
   $id = $_GET['id'];
   $sql = "";
   // 全部
   if($class == "all"){
       $sql = "select * from t_product";
   }
   // 积分
   if($class == "integral"){
       $sql = "select * from t_product where integral!=0";
   }
   // 一级分类
   if($class == "first"){
       $sql = "select * from t_product,t_product_type where t_product.product_type_id = t_product_type.id and t_product_type.pId = '{$id}'";
   }
   // 二级分类
   if($class == "second"){
       $sql = "select * from t_product where product_type_id ='{$id}'";
   }
  $r = mysqli_query($mysqli,$sql);
  $arr = array();
  $i = 0;
  while($row = mysqli_fetch_array($r)){
   $arr[$i] = $row;
   $i++;
  }
   echo json_encode($arr);
?>

你发本地的访问地址,别人也访问不到。

运行时有没有错误信息呢?

兄弟,你的$mysqli呢?

echo mysqli_error($mysqli);能查看有关错误信息