Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

outputting array from mysql?

Options
  • 15-10-2005 11:09pm
    #1
    Registered Users Posts: 2,031 ✭✭✭


    Is there any simple way to output the entire array in a mysql query in php to an HTML table without having the reference the fieldnames individually?

    I've got an screen where the user dynamically selects fields, (there are 30+ fields) and then returns the results to a table.

    I could of course code a couple of dozen variables for this, but surely there's a better way?


Comments

  • Registered Users Posts: 5,335 ✭✭✭Cake Fiend


    [php]
    echo "<table>";
    foreach( $array as $var )
    {
    echo "<tr><td>";
    echo $var;
    echo "</td></tr>";
    //any other stuff
    }
    echo "</table>";
    [/php]


Advertisement