我正在尝试确定第一次尝试或第二次尝试通过测试的学生人数的百分比。我相信我的代码是正确的,但是当我回显结果时,我没有得到任何输出。
<?php
$NREMT1 = "SELECT nremtcognitive FROM course_students WHERE nremtcognitive = '1' ";
$NREMT2 = "SELECT nremtcognitive FROM course_students WHERE nremtcognitive >= '2' ";
$completed = "SELECT studentstatus FROM course_students WHERE studentstatus >='4'";
$getNREMT1 = mysql_query($NREMT1);
$fetchNREMT1= mysql_num_rows($getNREMT1);
$getNREMT2 = mysql_query($NREMT2);
$fetchNREMT2= mysql_num_rows($getNREMT2);
$getcompleted = mysql_query($completed);
$fetchcompleted= mysql_num_rows($getcompleted);
function percent($fetchNREMT1, $fetchNREMT2, $fetchcompleted) {
$NREMT1count= $fetchNREMT1/$fetchcompleted;
$NREMT1percent= $NREMT1count * 100;
$NREMT1result = number_format($NREMT1percent,0);
$NREMT2count= $fetchNREMT2/$fetchcompleted;
$NREMT2percent= $NREMT2count * 100;
$NREMT2result = number_format($NREMT2percent,0);
}
echo $NREMT1result;
echo $NREMT2result;
?>