print "<table>\n"; print "<tr>\n";
$counter = 0; while ($result = mysql_fetch_array($pointer)) { $counter++; if ($counter % 4 === 0) { print "<td>".$result[1]."</td>\n"; print "</tr>\n"; print "<tr>\n"; } else { print "<td>".$result[1]."</td>\n"; } }
// add blank cells if number of cell on last row isn'4 four. for ($i = 0; $i < $counter % 4; $i++) { print "<td> </td>\n"; }
print "</tr>\n"; print "</table>\n";
---------------------------------
Larry L wrote:
I'm sure this is easy and I'll feel silly when I see how it's done, but, my mnd is a blank,
this structure prints out a table with a new row for each item
<table > <? While ( $results = mysql_fetch_array($pointer)) { print "<tr><td ><$results[1] </td></tr>" ; } ?> </table>
what I want to do is print out a table 4 columns wide and however many rows high needed to run through the data
HOW do I loop through the array and get <td>data</td> printed 4 times then a new row started and then 4 more <td> cells printed, etc
thank you in advance
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php