0% found this document useful (0 votes)
5 views2 pages

Mod

The document contains PHP code that retrieves and processes student results from a database. It calculates the number of subjects passed and failed by a student based on their scores and grading criteria. The results are then displayed, indicating whether the student passed all subjects, failed all subjects, or the count of subjects passed and failed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Mod

The document contains PHP code that retrieves and processes student results from a database. It calculates the number of subjects passed and failed by a student based on their scores and grading criteria. The results are then displayed, indicating whether the student passed all subjects, failed all subjects, or the count of subjects passed and failed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<div style="max-width:98%;">

<pre>Students remarks</pre>
<?php
$studID = $queryGetStudent["st_id"];
// getting a courseID
$query_res_course = mysqli_query($conn,"SELECT DISTINCT c_id FROM
result WHERE st_id = '$studID'");
foreach ($query_res_course as $key_res_course => $value_res_course)
{
$isCID = $value_res_course["c_id"];
$dsub_id_query = mysqli_query($conn,"SELECT DISTINCT subject_id
FROM result WHERE st_id = '$studID' AND c_id = '$isCID' AND d_id = '$d_id' AND
ds_id = '$ds_id'");
// declaring variables for incrementing the passing and failure
marks
$npass = 1;
$nfail = 1;
$sumpass = 0;
$sumfail = 0;
foreach ($dsub_id_query as $key_sub_id => $value_sub_id) {
$isSubID = $value_sub_id["subject_id"];
$row_subj_sum = mysqli_fetch_assoc(mysqli_query($conn,"SELECT
sum(score) FROM result WHERE st_id = '$studID' AND c_id = '$isCID' AND d_id =
'$d_id' AND ds_id = '$ds_id' AND subject_id = '$isSubID'"));
$sum_markx = $row_subj_sum["sum(score)"];
// getting passing marks
$pass_grade_row = mysqli_num_rows(mysqli_query($conn,"SELECT * FROM
grading_table WHERE grading_status = 'passed' AND high_score >= '$sum_markx' AND
low_Score <= '$sum_markx'"));
if ($pass_grade_row >= 1) {
// incrementing the students passing marks
$sumpass += $npass;
}else{
// incrementing the students failure marks
$sumfail += $nfail;
}
}
$numsub =
mysqli_num_rows(mysqli_query($conn,"SELECT DISTINCT subject_id FROM result WHERE
st_id = '$studID' AND c_id = '$isCID' AND d_id = '$d_id' AND ds_id = '$ds_id'"));
if ($numsub == $sumpass) {
echo "<p style = 'color:green;'>Passed all
subjects subjects</p>";
}
if ($numsub == $sumfail) {
echo "<p style = 'color:red;'>Failed all
subjects subjects</p>"; }
echo "<p style = 'color:green;'>Passed ".
$sumpass." subjects</p>";
echo "<p style = 'color:red;'>failed ".
$sumfail." subjects</p>";
}
?>
</div>

$numsms1 = mysqli_num_rows(mysqli_query($conn,"SELECT *
FROM duraton_semester WHERE d_id = '$did'"));
$numsms = mysqli_num_rows(mysqli_query($conn,"SELECT
DISTINCT ds_id FROM duraton_semester WHERE d_id = '$d_id'"));

You might also like