Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

outputting array from mysql?

  • 15-10-2005 11:09PM
    #1
    Registered Users, Registered Users 2 Posts: 2,011 ✭✭✭


    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, Registered Users 2 Posts: 5,333 ✭✭✭Cake Fiend


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


Advertisement