while loops for rows in PHP -


new php , i'm trying have 8 rows 2 cells using while loop. can't seem right, i've played code lot comes out wrong. point in right direction appreciated

 <section class="grabber2">                 <?php                 $x = 0;                     echo '<tr>';                     while ($x < 4){                         echo                         '<td> phrase 1!</td>',                         '<td> phrase 2!</td>';                          $x++;                     }                         ?></tr>             </section> 

tr comes before td. tr=table row. td=table column

try this:

<table>      <?php          $x = 0;          while ($x < 8){              echo '<tr>';              echo '<td> phrase 1!</td><td> phrase 2!</td>';               echo '<tr>';              $x++;          }     ?> </table> 

section tag useful apply css styling components. don't need in case. also, try use nested <div> tags instead of <table>.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -