RE: DB Print Columns and Rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
>        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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux