Jump to content

use php to display record!!!

- - - - -

  • Please log in to reply
No replies to this topic

#1
noprobz09

noprobz09

    Newbie

  • Members
  • Pip
  • 8 posts
Hello to all PHP coder! I want again your brilliant ideas, please suggest me... My last post here was already solved...And I have my new problem at this time...this is my code:
<table width="100">

<tbody>

<?php

 $trapTable=mysql_query("SELECT * FROM trap WHERE subCode='$code' AND instructor='$user'");

 while($trapResult=mysql_fetch_assoc($trapTable))

 {//start for first while  ?>



 <?php

    echo'<th>';

    echo$trapResult['trapRecordName'];

    echo'</th>';

// }

?>

<tr>

<?php  /*

    $recName=$trapResult['trapRecordName'];

    $gradeSql=mysql_query("SELECT *FROM gradebook WHERE recordName='$recName' AND instructor='$user' AND subCode='$code'");

    while($gradeResult=mysql_fetch_assoc($gradeSql))

     {//start first while()

     // echo'<tr>';

      echo'<td>';

      echo$gradeResult['studScore'];

      echo'</td>';

     // echo'</tr>';

     }//end second while() */


 }//end for first while()

?>

<tr>

<hr>

<?php

echo'<table>';

$trapTable=mysql_query("SELECT * FROM trap WHERE subCode='$code' AND instructor='$user'");

 while($trapResult=mysql_fetch_assoc($trapTable))

 {//start while





   // echo$trapResult['trapRecordName'];

   echo'<td>'.$trapResult['trapRecordName'].'</td>';

   //$arrayRname[]=$trapResult['trapRecordName']

 }//end while()


//echo'<th>'.'Heading 2'.'</th>';


echo'</table>';

?>


</tbody>

</table>

<hr>

<?php

$i=0;

$trapTable=mysql_query("SELECT * FROM trap WHERE subCode='$code' AND instructor='$user'");

while($trapResult=mysql_fetch_assoc($trapTable)) {

   $recName = $trapResult['trapRecordName'];

   $chapters[] = $recName;

   $gradeSql=mysql_query("SELECT * FROM gradebook WHERE recordName='$recName' AND instructor='$user' AND subCode='$code'");


   while($gradeResult=mysql_fetch_assoc($gradeSql)) {

      $id = $gradeResult['studId']; /* you need the right col name for this */

      /* this creates an array with $std[12345]['chaper1'] = score */

      $std[$id][$recName] = $gradeResult['studScore'];

      $i++;

   }

}

?>


<table width="100">

<tbody>


<tr>

<?php

// this creates the header

foreach ($chapters as $recordName){

?>

<th>

<?php

   echo $recordName;

?>

</th>

<?php } ?>

</tr>


<tr>

<?php

// then for each student we print out their scores for each chapter

foreach($std as $studentRecord){

echo'<tr>';

   foreach ($chapters as $recordName){

      echo'<td>';

      echo $studentRecord[$recordName];

      echo'</td>';

   }

echo'</tr>';

}

?>

</tr>

</tbody>

</table>
For the above codes...I want to display the name of the students with their corresonding scores...the student records is in STUDENTFILE table...I have no idea at this time how to do it...Please help me! THANK YOU! and GOD BLESS!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users