...

View Full Version : Populating a 4x8 table



sergxp
08-14-2008, 08:13 PM
I am styling a store script and I need to populate a 4x8 table with this one query that spits out products. Now I don't know how to tell it to do new <tr> after 4 <td> so it would be 4x8 table. Surely someone knows how to do that. Please Help.

hinch
08-14-2008, 08:18 PM
use counters eg:


$rowcount=0;
while (query) {
if ($rowcount==0) {
echo "<tr><td>";
echo $dbstuff[];
echo "</td>";
$rowcount=$rowcount+1;
}
if ( ($rowcount==2) || ($rowcount==3)) {
echo "<td>";
echo $dbstuff[];
echo "</td>";
$rowcount=$rowcount+1;
}
if ($rowcount==4) {
echo "<td>";
echo $dbstuff[];
echo "</td></td>";
$rowcount=0;
}
}

then put a colcount in there too and an overall if colcount==8 break to finish the display loop.

there may be an easier way but thats all i could think of off top of head



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum