Page 1 of 1

Multiple Table Columns

Posted: Mon Sep 17, 2007 3:29 pm
by psurrena
If I'm returning results via a while loop, how would I insert "</td><td>" every 25 results?

Thank you

Posted: Mon Sep 17, 2007 3:50 pm
by Christopher

Code: Select all

// in loop
++$column;
if ($column >= 25) {
     echo "</td><td>";
     $column = 1;
}

Posted: Mon Sep 17, 2007 4:01 pm
by feyd
I prefer the modulus operator.

Code: Select all

$column % 25 == 0 and $column != 0

Posted: Mon Sep 17, 2007 4:12 pm
by psurrena
Great, thanks everyone!