html5 - Arrange data in tables? -


i retrieve data database , tried implement them in table, don't know how arrange them in table. view is:

<?php include('inc/header.php');?>  <div class="main">  <table>      <thead>             <tr>id:</tr>             <th>name:</th>  </thead>  <tbody> <tr>          <?php foreach ($view $row) :?>              <?php $i = 1;?>             <?php echo "<td>".$row->audio."</td>";?>             <?php echo $i++;?>             <?php endforeach;?>       </tr> </tbody>  </table>   </div> <?php include('inc/footer.php');?> 

i want make place id increase 1 many records , arrange them 1 table.

your foreach loop should this

<tbody>     <?php      $i = 1;     foreach ($view $row)     {         echo "<tr>";         echo "<td>".$i."</td>";         echo "<td>".$row->audio."</td>";         $i++;         echo "</tr>";     }    ?> </tbody> 

and <thead> should be

<thead>     <tr>         <th>id:</th>         <th>name:</th>     </tr> </thead> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -