HELP = PHP Results in Collumn

Hello, i have finished a website for my family friends shop however i want to put results in columns rather than a row. It currenty looks like http://tinypic.com/r/2mra6ns/8 . A pictures of the code is : http://tinypic.com/r/143dlsi/8

The code used to create that is…

<?php $sql = "SELECT * FROM abs_productcat WHERE catid = $catid ORDER BY catid ASC"; $can = mysql_query($sql); $catname = mysql_fetch_assoc($can); ?>

and in the body…

<?php while ($row_pro = mysql_fetch_assoc($rs_proddetails)) { ?>
                        <td><table width="243" border="0" align="left" cellpadding="15" cellspacing="0" class="sectionborders">
                          
                          <tr>
                            <td height="120" align="center"><p><strong><a href="indproducts.php?ProductID=<?php echo $row_pro['ProductID']; ?>"><img src="products/product_<?php echo $row_pro['ProductID']; ?>" alt="<?php echo $row_pro['ProductName']; ?>" height="120" class="sectionborders" border="0" /></a></strong></p>
                              <p><strong><a href="indproducts.php?ProductID=<?php echo $row_pro['ProductID']; ?>" class="products"><?php echo $row_pro['ProductName']; ?></a></strong></p></td>
                          </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                      </tr> <?php } ?>

Would really apretiate your help!

Thanks!

Tom

[php]<?php
$i = 0;
$new_row = 3;
echo ‘

’;
while ($row_pro = mysql_fetch_assoc($rs_proddetails)) {
if($i == $new_row){
echo ‘’;
}
echo ’







'.$row_pro['ProductName'].'



‘.$row_pro[‘ProductName’].’




';
$i++;
if($i == $new_row){
$i = 0;
echo ’

 
';
}
}
?>[/php]

To explain this, $new_row is set so it knows when to start a new row. For each column $i has 1 added to it.
When $i == $new_row it starts a new row.
Have to be a bit creative with the starting

etc but you should get a good idea of how this is working
Sponsor our Newsletter | Privacy Policy | Terms of Service