Hello all
I am using two nested for loops. The first loop is to print the rows and the second loop is to print columns. The problem is that the scond loop prints horizontally BUT I want to print vertically. HOW?? see the code below
$n_rows = count($student_name);
$n_cols = count($student_name);
$control = 0;
for($i = 0; $i < $n_rows; $i++){
echo ("<TR>\n");
echo ("<td width='100' bgcolor='#FFFFFF'><font size='2' face='Arial, Helvetica'>$student_name[$i]</font></td>\n");
for($j = 0; $j < $n_cols; $j++){
if(!($result2 = mysql_query("SELECT pdc_member.member_id from pdc_member
WHERE pdc_member.student_id = '$student_id[$control]'", $con))){
Error(sprintf("Internal Error %d:%s\n",mysql_errno(),mysql_error()));
exit();
}
$row2 = mysql_fetch_array($result2);
$m_id = $row2["member_id"];
if(!($result3 = mysql_query("SELECT evaluation FROM pdc_assessment
WHERE member_id='$m_id'", $con))){
Error(sprintf("Internal Error %d:%s\n",mysql_errno(),mysql_error()));
exit();
}
while($row3 = mysql_fetch_array($result3)){
$evaluation[] = $row3["evaluation"];
}//close while
if(!empty($evaluation[$control])){
echo ("<td width='100'><input TYPE='text' NAME='field_name[]' value='$evaluation[$control]' size='3'></td>\n");
}else{
echo ("<td width='100'><a href='peerass_form.php'>Do</a></td>\n");
}
$final_result = $final_result + $evaluation[$control];
$control = $control+1;
}// closing the inner for
echo ("<td width='100'><input TYPE='text' NAME='result_set[]' value='$final_result' size='4'></td>\n");
echo (" </TR>\n");
$final_result = 0.0;
I want the names to be printed horizontally and vertically both. That is ok now but I want the second loop to print only vertically in relation to the name. HOW?
Thanks in advance