这是我的代码:
<html>
<?php
include ("connect.php");
// Retrieve data from Query String
if( $_REQUEST["ano"] || $_REQUEST["km"] || $_REQUEST["cat"])
//print your car is model xxxx
echo "tu coche es un ". $_REQUEST["cat"] . ".";
//start connection to mysql db
$con = mysqli_connect('localhost', $dbuser, $dbpass, $dbname);
//mysql query to get average price of select model of car
$query = 'SELECT AVG(price) FROM `fl_listings` WHERE `tmp_catkey` = `'.$_REQUEST["cat"].'`';
$qry_result = mysqli_query($con, $query);
while($row = mysqli_fetch_array($qry_result))
{
echo "<br> El rango de precios de venta es de: ".$row['AVG(price)'];
}
$promedio = $row['AVG(price)'];
?>
</html>
我一直在更改引号以查看它是否有效。我无法得到结果。我得到的最好的是没有$row['AVG(price)']
在另一次尝试中我得到了这个警告:
警告:mysqli_fetch_array()期望参数1为mysqli_result,boolean given