Click to See Complete Forum and Search --> : tabel formating


zatomas
10-26-2007, 05:20 AM
hello dear all..
and thanks for all the gr8 help i get from this website...
i have result frome the select query and i want to display it in this format

item1 item2 item 3
item4 item5 item6
etc
on tabel where i can manage the cells background color to make it user firendy.....

how can i do that where normal php code on dreamweaver shos it like this
item1
item2
item3
etc
and thanks

zatomas
11-04-2007, 02:37 AM
is it undoable......
any replay may be usful

NogDog
11-04-2007, 03:33 AM
This is often done with the modulus operator (http://www.php.net/manual/en/language.operators.arithmetic.php) ("%").

<table>
<tr>
<?php
$counter = 1;
while($row = mysql_fetch_assoc($result))
{
echo "<td>{$row['some_value']}</td>";
if($counter % 3 == 0 and $counter < mysql_num_rows($result))
{
echo "</tr>\n<tr>";
}
$counter++;
}
?>
</tr>
</table>