SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast nixon's Avatar
    Join Date
    May 2003
    Location
    Australia
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question presenting results in a table

    I am trying to write a bit of script that presents data from a mysql database in a viewable table. Can't quite get started. A bit of script showing a fetch array presented in a multi column table would be much appreciated. The columns are id, date, job description, etc and the rows need to correspond to the most recently submitted job going down.
    Cheers

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try
    PHP Code:
    $sql "select * from table order by date ASC";
    $result mysql_query($sql) or die(mysql_error());

    echo 
    '<table><tr><td>id</td><td>date</td><td>descr</td></tr>';
    while(list(
    $id$date$desc) = mysql_fetch_row($result))
    {
    echo 
    '<tr><td>'.$id.'</td><td>'.$date.'</td><td>'.$desc.'</td></tr>';
    }
    echo 
    '</table>'
    the neigbours (free) WIFI makes it just a little more fun

  3. #3
    SitePoint Enthusiast nixon's Avatar
    Join Date
    May 2003
    Location
    Australia
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks peanuts that worked a treat


Bookmarks

Posting Permissions

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