Jump to content

PHP Results into Columns

Go to solution Solved by Barand,

Recommended Posts

Hello - hope you are all well.


I am creating a website for a family friend who has a shop. See preview of the site in this picture .... post-173410-0-36282300-1414844008_thumb.jpg


Currently the results are showing in one column. I want to show them in three columns in the format of:


1 2 3

4 5 6 

7 8 9 etc


But formatted with the picture and then the title and the border.


The current code i have is....






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







 <?php while ($row_pro = mysql_fetch_assoc($rs_proddetails)) { ?><tr>
                            <td><table width="243" border="0" align="left" cellpadding="15" cellspacing="0" class="sectionborders">
                                <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>
                            <td> </td>
                          </tr> <?php } ?>






Link to comment
Share on other sites

Tip: you can use the <> icon in the tool bar to post your code, so that it will have syntax highlight and will be easier to read.


The first step for you would be to try to achieve the result in pure / hardcoded HTML first. Try to do this, then try to apply it to your PHP code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.