0

SO im trying to generate and 8 x 8 table

while($a <= 8) {
    echo "<tr>";

    while($b <= 8) {
        echo "<td> tell me </td>";
        $b++;
    }

    echo "</tr>";
    $a++;
}

and i cant tell whats wrong

2
Contributors
1
Reply
10
Views
1 Year
Discussion Span
Last Post by Chris_33
0

For anyone else who stumbles here since the OP did not provide the solution when Self-Answered.
If you start at 0 with the logic above it will produce 9 rows and 9 columns because 0 is the first step. 0-8 is nine steps.

$row = 0;
$column = 0;
while($row < 8){  //0-7 = 8 steps (<= 8 would be 9 steps)
    echo "<tr>";
    while($column < 8){ 
        echo"<td> - </td>";
        $column++;
    }
    echo "</tr>";
    $row++;
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.