#1
  1. No Profile Picture
    Robert
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi,

    I'd like to output some query results in a table, each result in it's own column and row. Here's an example --

    ***********************************
    IF ($result){
    echo "<center><table><tr><td>";
    while ($r = mysql_fetch_array($result)) {
    $number = $r["stock_number"];
    $description = $r["item_description"];
    echo "$number<br></td>";
    echo "<td>$description<br>";
    }
    echo "</td></tr></table>";
    } else
    {
    echo "No data.";
    *********************************

    Except it doesn't work correctly. What is the proper way to accomplish this?

    Thanks
  2. #2
  3. No Profile Picture
    Borry
    Guest
    Devshed Newbie (0 - 499 posts)
    Hello,

    please try this out :

    You've got to make once a table and you got to embed for each productnr. and description a own row and column.

    I hope this will help you out !

    ***********************

    echo "<center><table>";
    IF ($result)
    {
    while ($r = mysql_fetch_array($result))
    {
    $number = $r["stock_number"];
    $description = $r["item_description"];
    echo "<tr><td>$number<br></td>";
    echo "<td>$description</td></tr>";
    }
    echo "</table>";
    } else
    {
    echo "No data.";

    *********************************

Similar Threads

  1. League table problem
    By silverduck in forum MySQL Help
    Replies: 8
    Last Post: February 10th, 2004, 01:38 PM
  2. MySQL output to table using phpBB
    By CCCMTech in forum PHP Development
    Replies: 0
    Last Post: February 2nd, 2004, 03:43 PM
  3. output data to table
    By phpfan in forum PHP Development
    Replies: 2
    Last Post: January 31st, 2004, 07:04 AM
  4. Replies: 0
    Last Post: January 30th, 2004, 03:18 PM
  5. how to keep table on top, not centered??
    By vinyl in forum HTML Programming
    Replies: 2
    Last Post: January 20th, 2004, 07:19 PM

IMN logo majestic logo threadwatch logo seochat tools logo