Results 1 to 2 of 2

Thread: Display Results in Table

  1. #1
    Join Date
    Nov 2005

    Display Results in Table

    I am trying to get the values from a mysql query to display in a table within PHP.

    I used this from W3School:


    echo "<table border='1'>

    while($row = mysql_fetch_array($result))
    echo "<tr>";
    echo "<td>" . $row['FirstName'] . "</td>";
    echo "<td>" . $row['LastName'] . "</td>";
    echo "</tr>";
    echo "</table>";

    Which looks like this.

    Heading 1 | Heading 2 | Heading 3

    Value 1 | Value 2 | Value 3


    But I would like the table to go the other way. Headings going down, each in its own row with values from sql to the right of them.

    Heading 1 | Value 1
    Heading 2 | Value 2
    Heading 3 | Value 3

    Attached is an example of what the table needs to look like. Sorry, hard to explain. Thanks!
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    You want it to say;

    FirstName George
    LastName Jones

    If you have more than one row of results what do you want to do?

    FirstName George
    LastName Jones
    FirstName Bill
    LastName Simith


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles