[snip]
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
[/snip]
Is the data all in one row in the database?
<?php
$results = mysql_fetch_array($pointer)
print "<tr>\n;
for($i = 0; $i < count($results); $i++){
if(0 = $i%4){
print "<td>" . $results[$i] . "</td>\n</tr>\n<tr>\n";
} else {
print "<td>" . $results[$i] . "</td>\n";
}
}
print "</tr>";
?>
NOT TESTED and may give too many <tr> tags. You'll need to test for
total data cells returned
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php