RE: [PHP-DB] DB Print Columns and Rows
| From: | joakim dot andersson at cybercom dot se | Date: | Thu, 24 Oct 2002 14:59:20 +0000 |
| Subject: | RE: [PHP-DB] DB Print Columns and Rows | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-22662@lists.php.net to get a copy of this message | ||
>
> Hello PHP people. I was wondering if I could get a
> question answered?
>
> How would I print a Database Table into a <table> when
> the DB Table
> has 4 columns, AND 4 rows.
>
> See I only know how to print one column.
<?php
// Your dB-stuff here...
$separator = "";
echo "<table><tr>";
while($row = mysql_fetch_array($result));
{
echo $separator";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "<td>" . $row[3] . "</td>";
$separator = "</tr><tr>";
}
echo "</tr></table>";
?>
Regards
Joakim