Reputation: 189
I run the query directly through PHP MyAdmin and it returns 1 result. 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'];
Upvotes: 1
Views: 68
Reputation: 878
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"]);
}
}
Upvotes: 1
Reputation: 22532
Closing ) and "
issue it would be
$query_road_tax = mysqli_query($conn011, "SELECT * FROM
road_tax_pricing WHERE (tax_from_co2 <='$vehicle_co2' AND tax_upto_co2 >='$vehicle_co2')");
Upvotes: 4