繁体   English   中英

Mysqli查询结果返回空但不应

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

我直接通过PHP MyAdmin运行查询,它返回1个结果。 我想念什么吗? 好吧,我一定是,我不能把头缠起来!?!

我想我只是累了什么! 任何帮助将非常感激:-

$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'];

结束) and "问题将会是

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

尝试-您可能需要循环打印结果。

$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