Hi all, can someone please teach me how to make it so that for every 3 tds, theres 1 tr and pull 9 total row values out of the mysql database and paste them in rows of 3 going across, and 3 going down?
Ex:
<tr>
<td>My TD</td>
<td>My TD2</td>
<td>My TD3</td>
</tr>
<tr>
<td>My TD4</td>
<td>My TD5</td>
<td>My TD6</td>
</tr>
<tr>
<td>My TD7</td>
<td>My TD8</td>
<td>My TD9</td>
</tr>
Here's my code:
<?php
$numrows = 0;
echo "<table border=\"1\"><tr>\r\n";
$sql = "mysqlqueryhere";
while($row = mysql_fetch_array($sql)){
echo "<td align=\"left\">\r\n";
echo "<img src=\"".$row['itemimage']."\"></img><br>\r\n";
echo $row['itemprice']."<br>\r\n";
$numrows++;
if($numrows > 2) {
echo "</td></tr><tr>";
$numrows = 0;
} else {
echo "</td>\r\n</tr>\r\n";
}
}
echo "</tr></table>";
?>
Thank you!
CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !