Jump to content

PedroSoares

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by PedroSoares

  1. Hello guys,

    I'm having trouble making a loop to display the data in a table, I need the loop to display a table with the following data:

    example:

     

    1 2 3

    1 2 3

    4 5 6

    4 5 6

    7 8 9

     

     

    My code:

    <?php

    echo '<table width="100%" border="1" cellspacing="0" cellpadding="0">';

    $contador = 1; 

        while ($contador <= 10) { 

            if($contador % 2){

                for($x=0;$x<2;$x++){

                    echo "<tr><td>Registro $contador</td>";

                }

            }else{

                echo "<td>Registro $contador</td></tr>";

            }

            ++$contador;

        }

    echo '</table>';

    ?>

     

    Help me!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.