I have a "while loop" on a PHP page with stuff coming from a DB, how do I make that the content should come as a table with a few row and columns?

Member Avatar

Search this forum - this has been covered about a million times over the last two months. Just press the Search button at the top (with no search term) - this will take you to the advanced search page.

Member Avatar

if (isset($_POST['submit'])) {
    echo "<table width = 90% border = '1' cellspacing = '5' cellpadding = '0'>";
    // set variables from form input
    $rows = $_POST['rows'];
    $columns = $_POST['columns'];
    // loop to create rows
    for ($r = 1; $r <= $rows; $r++) {
        echo "<tr>";
        // loop to create columns
        for ($c = 1; $c <= $columns;$c++) {
            echo "<td>&nbsp;</td> ";
        }     echo "</tr> ";
    echo "</table> ";


instead of &nsbp; use your row within that.

commented: Answer is nice and clear... +1

please post your code here so we help you batter..