|
Posted by Alvaro G Vicario on 10/06/70 11:17
*** Aaron Reimann wrote/escribió (31 May 2005 07:55:35 -0700):
> I am trying to build a table using results from a database query.
> Right now (code below), the code displays each result in a new <tr>. I
> am wanted to display 3 results in one <tr> </tr>, and then create a new
> <tr> with another 3, etc.
$position=0;
while( ... ){
if($position==0){
echo '<tr>';
}
echo '<td>' . $data . '</td>';
if($position==2){
echo '</tr>';
}
$position=($position+1) % 3;
}
We leave completing last line as an exercise for the reader ;-)
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Navigation:
[Reply to this message]
|