php - how do i print data vertically using loops -


i have following problem . print data table name exam having student_id , marks_obtained each student_id and. output follow

enter image description here

but want table in different format

----------------------- subject | marks | total ----------------------- 

toward down side see output

enter image description here

but confused in code please me code follow:

$roll=$_post['roll']; $exam=$_post['exam']; $int1 = intval(preg_replace('/[^0-9]+/', '', $exam), 10);  $student_info="select student_id,name,father_name,mother_name,roll,class_id,birthday,parent_id student roll='$roll'"; $result_student=mysqli_query($link, $student_info) or trigger_error('login info error'); $data_student= mysqli_fetch_array($result_student,mysql_both);   $parent_info="select name parent parent_id='$studentparent'"; $result_parent=mysqli_query($link, $parent_info) or trigger_error('login info error'); $data_parent= mysqli_fetch_array($result_parent,mysql_both);  $parentname= $data_parent['name'];  $subject_info="select subject_id,name subject class_id='$studentclass'"; $result_subject=mysqli_query($link, $subject_info) or trigger_error('login info error'); $data_subject= mysqli_fetch_array($result_subject,mysql_both); 

<table>  <tr>   <td> subject </td>   <td> marks </td>   <td> total </td>  </tr>  <tr>  <?php  for($i=0;i<count($data);i++){  ?>   <td><?php echo $data['subject_name'];?></td>   <td><?php echo $data['marks'];?></td>   <td><?php echo $data['total'];?></td>  <?php  }   </tr> </table> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -