Php Mysqli查询结果返回空,但不应返回

Php Mysqli查询结果返回空,但不应返回,php,mysqli,Php,Mysqli,我直接通过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_ta

我直接通过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'];

试试看-你可能需要在循环中打印结果

$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"]);
  }
}

试试看-你可能需要在循环中打印结果

$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"]);
  }
}
关闭并发布它将是

$query_road_tax = mysqli_query($conn011, "SELECT * FROM 
road_tax_pricing WHERE (tax_from_co2 <='$vehicle_co2' AND tax_upto_co2 >='$vehicle_co2')");
关闭并发布它将是

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

检查您提供的连接字符串是否与连接页面中写入的连接字符串完全相同。检查您提供的连接字符串是否与连接页面中写入的连接字符串完全相同。非常感谢!!!我只是无法透过我的眼睛的红色应变看到它!!!非常感谢你!!!我只是无法透过我的眼睛的红色应变看到它!!!