How to ignore an empty row in a table

1

I am making a table and when a value is empty I would like you to ignore the value and fill it with the next line with value.

With the code below, nothing appears, neither value nor value.

<table class="table table-striped" id="tblGrid">
<thead>
<tr>
<th align="left">Observações</th>
</tr>
</thead>
<tbody>
    <?php while ($row_itens_vazio = $resultado_itens_vazio->fetch_array()) {?>
      <tr>
      <?php if($row_itens_vazio["obs_tab_itens_cot"]>0){?>
        <td align="left" class="td1">
           <?php echo $row_itens_vazio["obs_tab_itens_cot"];?>
        </td>
           <?php } ?> 
      </tr>
    <?php } ?> 
</tbody>
</table>
    
asked by anonymous 16.06.2017 / 18:33

1 answer

1

You can solve this by using continue and empty of php.

  

Example

<table class="table table-striped" id="tblGrid">
<thead>
<tr>
<th align="left">Observações</th>
</tr>
</thead>
<tbody>
    <?php while ($row_itens_vazio = $resultado_itens_vazio->fetch_array()) {
             //verifica se um valor é vazio.
             if(empty($row_itens_vazio['obs_tab_itens_cot'])) {
                 continue; //volta para cima no próximo registro
             }
      ?>
      <tr>
      <?php if($row_itens_vazio["obs_tab_itens_cot"]>0){?>
        <td align="left" class="td1">
           <?php echo $row_itens_vazio["obs_tab_itens_cot"];?>
        </td>
           <?php } ?> 
      </tr>
    <?php } ?> 
</tbody>
</table>
    
16.06.2017 / 22:49