Thursday 12 September 2013

Generating a 4 columns by 13 row table

Generating a 4 columns by 13 row table

I am currently generating a table in the following manner:
A A1 A2 B
B C C1 D
I'd like to do:
A C
A1 C1
A2 D
B
So basically make it progress vertically with 13 rows and 4 columns.
Current code:
<table cellspacing="2px">
<?php
# display products in 4 column table #
$i=0;
while ($data=mysqli_fetch_array($result)){
if($i > 0 and $i % 4 == 0) {
echo '<tr></tr>';
}
//passing id in link to retrieve product details
echo '<td><a
href="displayProduct.php?product_id='.$data['product_id'].'"
class="myButton">'.$data['name'].'</a></td>';
$i++;
}
?>
</table>
Can someone point me in the right direction to accomplish this? I'm
shooting blanks atm.

No comments:

Post a Comment