<? $sqlYea="SELECT Yeae_ID FROM yearedu WHERE Yeae_End >= '".date("Y-m-d")."' "; $resultYea = $mysqli->query($sqlYea); $resultYea && $resultYea->num_rows>0; $rowYea = $resultYea->fetch_assoc(); $rowYea["Yeae_ID"]; $sql="SELECT * FROM schedule WHERE Cla_ID =$_REQUEST[Cla_ID] AND Roo_ID =$_REQUEST[Roo_ID] and Yeae_ID='".$rowYea["Yeae_ID"]."' group by SubJ_Code ORDER by SubJ_Code ASC"; $result = $mysqli->query($sql); if($result && $result->num_rows>0){ while($row = $result->fetch_assoc()){ $sqlSu="SELECT SubJ_Name FROM subject WHERE SubJ_Code = '$row[SubJ_Code]' "; $resultSu = $mysqli->query($sqlSu); $resultSu && $resultSu->num_rows>0; $rowSu = $resultSu->fetch_assoc(); $sqlSu1="SELECT Ssc_Sco1,Ssc_Sco2 FROM stuscores WHERE Stu_Code = $_REQUEST[Stu_Code] and SchD_ID=$row[SchD_ID] and Tem_ID='1' "; $resultSu1 = $mysqli->query($sqlSu1); $resultSu1 && $resultSu1->num_rows>0; $rowSu1 = $resultSu1->fetch_assoc(); $sqlSu2="SELECT Ssc_Sco1,Ssc_Sco2 FROM stuscores WHERE Stu_Code = $_REQUEST[Stu_Code] and SchD_ID=$row[SchD_ID] and Tem_ID='2' "; $resultSu2 = $mysqli->query($sqlSu2); $resultSu2 && $resultSu2->num_rows>0; $rowSu2 = $resultSu2->fetch_assoc(); $scores=$rowSu1[Ssc_Sco1]+$rowSu1[Ssc_Sco2]; $scoress=$rowSu2[Ssc_Sco1]+$rowSu2[Ssc_Sco2]; ($scores+$scoress); $score = $scores+$scoress; if( $score >= 80 ){ echo "4"; }else if( $score >= 75 && $score <= 79 ){ echo "3.5"; }else if( $score >= 70 && $score <= 74 ){ echo "3"; }else if( $score >= 65 && $score <= 69 ){ echo "2.5"; }else if( $score >= 60 && $score <= 64 ){ echo "2"; }else if( $score >= 55 && $score <= 59 ){ echo "1.5"; }else if( $score >= 50 && $score <= 54 ){ echo "1"; }else{ echo "0"; } } } ?>
<? $sqlYea="SELECT Yeae_ID FROM yearedu WHERE Yeae_End >= '".date("Y-m-d")."' "; $resultYea = $mysqli->query($sqlYea); $resultYea && $resultYea->num_rows>0; $rowYea = $resultYea->fetch_assoc(); $rowYea["Yeae_ID"]; $sql="SELECT * FROM schedule WHERE Cla_ID =$_REQUEST[Cla_ID] AND Roo_ID =$_REQUEST[Roo_ID] and Yeae_ID='".$rowYea["Yeae_ID"]."' group by SubJ_Code ORDER by SubJ_Code ASC"; $result = $mysqli->query($sql); if($result && $result->num_rows>0){ while($row = $result->fetch_assoc()){ $sqlSu="SELECT SubJ_Name FROM subject WHERE SubJ_Code = '$row[SubJ_Code]' "; $resultSu = $mysqli->query($sqlSu); $resultSu && $resultSu->num_rows>0; $rowSu = $resultSu->fetch_assoc(); $sqlSu1="SELECT Ssc_Sco1,Ssc_Sco2 FROM stuscores WHERE Stu_Code = $_REQUEST[Stu_Code] and SchD_ID=$row[SchD_ID] and Tem_ID='1' "; $resultSu1 = $mysqli->query($sqlSu1); $resultSu1 && $resultSu1->num_rows>0; $rowSu1 = $resultSu1->fetch_assoc(); $sqlSu2="SELECT Ssc_Sco1,Ssc_Sco2 FROM stuscores WHERE Stu_Code = $_REQUEST[Stu_Code] and SchD_ID=$row[SchD_ID] and Tem_ID='2' "; $resultSu2 = $mysqli->query($sqlSu2); $resultSu2 && $resultSu2->num_rows>0; $rowSu2 = $resultSu2->fetch_assoc(); $score=$rowSu1[Ssc_Sco1]+$rowSu1[Ssc_Sco2]+$scoress=$rowSu2[Ssc_Sco1]+$rowSu2[Ssc_Sco2]; if( $score >= 80 ){ $total =4; }else if( $score >= 75 && $score <= 79 ){ $total =3.5; }else if( $score >= 70 && $score <= 74 ){ $total =3; }else if( $score >= 65 && $score <= 69 ){ $total =2.5; }else if( $score >= 60 && $score <= 64 ){ $total =2; }else if( $score >= 55 && $score <= 59 ){ $total =1.5; }else if( $score >= 50 && $score <= 54 ){ $total =1; }else{ $total =0; } $total; $SumTotal = $SumTotal + $total.'/n'; } $a=array($SumTotal); $b= array_sum($a); echo $b/10; } ?>
echo $b/10;//ทำไมตรงเลข 10 ไม่ namrow จำนวนที่นำมาคำนวนด้วยเลยครับ เพื่อมีการเพิ่มลดวิชา คิดเห็นเฉยๆ นะ // $b/$a; อะไรประมาณนั้น
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง