简体   繁体   English

Mysqli查询结果返回空但不应

[英]Mysqli Query results returns empty but shouldn't

I run the query directly through PHP MyAdmin and it returns 1 result. 我直接通过PHP MyAdmin运行查询,它返回1个结果。 Am I missing something? 我想念什么吗? Well clearly I must be and I can't wrap my head round it!?! 好吧,我一定是,我不能把头缠起来!?!

I think I'm just tired or something! 我想我只是累了什么! Any help would be much appreciated:- 任何帮助将非常感激:-

$query_road_tax = mysqli_query($conn011, "SELECT * FROM road_tax_pricing WHERE (tax_from_co2 <='$vehicle_co2' AND tax_upto_co2 >='$vehicle_co2'");
$row_road_tax = mysqli_fetch_assoc($query_road_tax);
$Six_Month=$row_road_tax['tax_6month'];
$Twelve_Month=$row_road_tax['tax_12month'];

Closing ) and " issue it would be 结束) and "问题将会是

$query_road_tax = mysqli_query($conn011, "SELECT * FROM 
road_tax_pricing WHERE (tax_from_co2 <='$vehicle_co2' AND tax_upto_co2 >='$vehicle_co2')");

Try that - you might have to print the results in loop. 尝试-您可能需要循环打印结果。

$query = "SELECT * FROM road_tax_pricing WHERE (tax_from_co2 <='$vehicle_co2' AND tax_upto_co2 >='$vehicle_co2')";

if($query_road_tax = mysqli_query($conn011, $query)) {
  while ($row = mysqli_fetch_assoc($query_road_tax)) {

      /* print_r($row); */

      printf($row["tax_6month"]);
      printf($row["tax_12month"]);
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM