lundi 4 novembre 2019

How to exclude blank rows while printing a html table

I have a html table which consists of a the subjects and teachers that teaches them but there are some students that don't offer some subjects and I would like to exclude them when printing the results. Please how can i do that The code is something like this;

<tr class="row-info">
                            <td style="text-align: center;" class="col-subject"><?php echo $row3['name'];?></td>
                            <td style="text-align: center;" class="col-teacher"><?php echo $this->crud_model->get_type_name_by_id('teacher', $row3['teacher_id']); ?></td>
                            <td style="text-align: center;">
                                <?php $obtained_mark_query = $this->db->get_where('mark' , array(
                                'subject_id' => $row3['subject_id'], 'exam_id' => $row2['exam_id'],
                                'class_id' => $row1['class_id'], 'student_id' => $student_id , 
                                'year' => $running_year));
                                if ( $obtained_mark_query->num_rows() > 0)
                                {
                                $marks = $obtained_mark_query->result_array();
                                foreach ($marks as $row4)
                                echo $row4['mark_obtained'];        
                                } ?>
                            </td>

Aucun commentaire:

Enregistrer un commentaire