我想使用此代码
将结果显示到表中$q = $_GET['q'];
mysqli_select_db($con,"ofes");
$sql="SELECT * FROM tbl_summative_results WHERE subject_description = '".$q."'";
$result = mysqli_query($con,$sql);
$sql1="SELECT (round(AVG(pr1+pr2+pr3+pr4+pr5+pr6+pr7+pr8+pr9)/9,2)) FROM tbl_summative_results WHERE subject_description = '".$q."'";
$results = mysqli_query($con,$sql1);
while($row = mysqli_fetch_array($results)) {
echo "<tr>";
echo "<td style='background-color:#e9efc4;color:black;font-weight:bold'>" . $row['(round(AVG(pr1+pr2+pr3+pr4+pr5+pr6+pr7+pr8+pr9)/9,2))'] . "</td>";
echo "</tr>";
mysqli_close($con);
}
当我运行代码时,我总是有错误。
答案 0 :(得分:0)