XML显示[“ num_rows”] => int(0)

时间:2019-08-18 06:45:38

标签: javascript sql laravel

我有此代码,我尝试过var_dump结果,我的鱼卵数为0

对象(mysqli_result)#294(5){[“” current_field“] => int(0)[” field_count“] => int(10)[” lengths“] => NULL [” num_rows“ ] => int(0)[“ type”] => int(0)}

// Search the rows in the restaurants table
   $query = sprintf("SELECT  physical_address,opening_time,closing_time,days_of_operation,website,email,phone, lng, lat, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM restaurants HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20",
  mysqli_real_escape_string($connection,$center_lat),
  mysqli_real_escape_string($connection,$center_lng),
  mysqli_real_escape_string($connection,$center_lat),
  mysqli_real_escape_string($connection,$radius));

   $result = mysqli_query($connection,$query);
   $result = mysqli_query($connection,$query);
   if (!$result) {
     die("Invalid query: " .mysqli_error($connection));

   }
   else {var_dump($result);}

  // $roww = mysqli_fetch_array($result);
  // echo $roww;

  // echo @mysqli_fetch_assoc($result);
   while ($row = mysqli_fetch_assoc($result)){
     $node = $dom->createElement("restaurant");
     $newnode = $parnode->appendChild($node);

0 个答案:

没有答案