I wanted to perform the main loop first and use the first fetched data of the $code
and $per_section
to be used in the second loop. Then the second loop will perform its own loop and after that, it will return to the main loop.
PS: I am already aware about the deprecation of mysql_ extention.
PPS: I am new in php. Please help me.
$count_query=mysql_query("select * from subject where teacherid = '$get_id'");
while($row = mysql_fetch_array($count_query)){
$section = ($row['total_students']/ $total)*30;
$per_section = round($section, 0, PHP_ROUND_HALF_UP);
$code = $row['code'];
$user_query=mysql_query("select * from evaluation_result_student where faculty_id='$get_id'
and semester= '$semester' and subject_id ='$code' ORDER BY rand() LIMIT $per_section")or die(mysql_error());
while($row=mysql_fetch_array($user_query)){
$com=($row['commitment1']+$row['commitment2']+$row['commitment3']+$row['commitment4']+$row['commitment5'])/5 ;
$kno=($row['knowledge1']+$row['knowledge2']+$row['knowledge3']+$row['knowledge4']+$row['knowledge5'])/5 ;
$tea=($row['teaching1']+$row['teaching2']+$row['teaching3']+$row['teaching4']+$row['teaching5'])/5 ;
$mng=($row['management1']+$row['management2']+$row['management3']+$row['management4']+$row['management5'])/5 ;
$total_com += $com;
$total_kno += $kno;
$total_tea += $tea;
$total_mng += $mng;
$counter ++;
$student_query=mysql_query("select * from students where studentsID='$row[student_id]'")or die(mysql_error());
$student =mysql_fetch_array($student_query);
}
}?>