Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    print table using php

    hi,

    i want to fetch all records from mysql table and print every record as html table using php.but when i fetch the records,it will displays as one table only.
    but i want to display one record as one table.
    i dont need to print field names.
    please any of your help will be appreciated.

    thanks
    mrjameer
    Last edited by mrjameer; 01-02-2007 at 05:13 PM.

  • #2
    Regular Coder
    Join Date
    Sep 2006
    Location
    Colorado
    Posts
    132
    Thanks
    7
    Thanked 1 Time in 1 Post
    Try this:
    PHP Code:
    <?
    $sql 
    "SELECT * FROM table";
    $result mysql_query($sql);
    echo(
    "<table>");
    while(
    $newarray mysql_fetch_array($result))
    {
    echo(
    "<tr>");
    echo(
    "<td>");
    echo(
    $newarray[0]);
    echo(
    "</td>");
    echo(
    "</tr>");
    }
    echo(
    "</table>");
    ?>
    Obviously you'll have to edit the query and while loop to fit your needs.
    -bubbles

  • #3
    Regular Coder
    Join Date
    May 2004
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts
    within your while loop, create a table, fill out the rows, and end the table.

    ending the while loop first and then closing the table will result in only 1 table.


  •  

    Posting Permissions

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