PDA

View Full Version : Print a HTML table using PHP?


red_A
01-13-2005, 11:49 AM
How do print a HTML table using PHP? i want to be able to pull out data from a database and using a while loop have them printed in a table.

I have created a calendar and of course i want 7 colums and 5 rows and have them populated by PHP dynamically, is it possible?

ps. i forgot to mention that it will pull out these numbers/days from the days coloum in the DB that also have dynamic links, so the table should generate dynamic links aswell...

Thanks :)

Digitalosophy
01-13-2005, 12:20 PM
this should help

http://www.kirupa.com/web/phphtml.htm

Gazler
01-13-2005, 12:35 PM
<?php echo "<table>\n<tr>";
$x=0;
for ($counter=0; $counter<5; $counter++)
{
for ($i=0; $i<7; $i++)
{
if ($x==1)
{
echo "\n</tr><tr>";
$x=0;
}
echo "<td>$counter and $i x=$x</td>";
}
$x=1;
}
echo "</table>"
?>

output = http://www.gazler.com/kirupa/table.php