<?php
$q2 = "SELECT SUM(crd)
FROM coe_courses
INNER JOIN student_record ON coe_courses.course_number =
student_record.course_number WHERE student_record.id =".$_SESSION['user_id'] ;
$result = mysqli_query($con , $q2) ;
if($row = mysqli_fetch_array($result)){
echo $row["SUM(crd)"];
}
$q2a = "SELECT SUM(points) FROM student_record where student_record.id =".$_SESSION['user_id'] ;
$result = mysqli_query($con , $q2a) ;
if($row = mysqli_fetch_array($result)){
echo $row["SUM(points)"];
}
?>
分隔兩個聲明,我寫這個代碼,但我怎麼能在這個代碼的結束使部門對於這些陳述我如何在PHP
echo $row["SUM(crd)"] /$row["SUM(points)"];
$ N =(int)的($行[ 「SUM(CRD)」]/$行[ 「SUM(點)」]); – Deep
你的代碼的輸出是什麼? –
將結果存儲在變量中,然後進行計算 –