Re: How do I return 3 results and print </tr>



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



Relevant Pages

  • Re: JOYCE HATTO canonization
    ... We can leave it as an exercise to the ... reader where this perverse need comes from. ... Prev by Date: ...
    (rec.music.classical.recordings)
  • How Were Those Tables Computed?
    ... Even more remarkable than the existence of such tables, ... I leave it as an exercise for the reader, ... Prev by Date: ...
    (sci.math)
  • Re: I v P: Some Pictures and obvious caption contest
    ... > And this one is left as an exercise to the reader: ... His suggestions on pitch was accepted in Bengal vs. TN match, ... Prev by Date: ...
    (rec.sport.cricket)
  • Re: 3D Histogram
    ... > This is an exercise left to the reader. ... Regards (and sorry for my poor english) ... Prev by Date: ...
    (comp.graphics.apps.gnuplot)
  • Re: Logic Proofs
    ... Solutions are rather straight forward: ... The rest of the proof is left as an exercise for the reader. ... Prev by Date: ...
    (sci.math)