jrobles Posted January 6, 2010 Share Posted January 6, 2010 I am having a problem figuring out how to dynamically populate my table with info from my db. In the past I have been able to do this with tables that only have one DB table row per html table row, but this time I need to have three html table columns each with a row from the db.. here is a static example of what I need: <table width='335' border='0' align='center' cellpadding='2' cellspacing='0' id='nfpcatalog2'> <tr> <td colspan='2' align="center" valign='top'>$IMAGE1</td> <td colspan='2' align="center" valign='top'>$IMAGE2</td> <td colspan='3' align="center" valign='top'>$IMAGE3</td> </tr> <tr> <td width="68" valign='top'>$LINK1</td> <td width="69" valign='top'>$LINK1a</td> <td width="61" valign='top'>$LINK2</td> <td width="60" valign='top'>$LINK2a</td> <td width="86" valign='top'>$LINK3</td> <td width="63" valign='top'>$LINK3a</td> </tr> <tr> <td colspan='2' align="center" valign='top'>$TITLE1</td> <td colspan='2' align="center" valign='top'>$TITLE2</td> <td colspan='3' align="center" valign='top'>$TITLE3</td> </tr> <tr> <td colspan='2' valign='top'><div align='center'>$PRICE1</div></td> <td colspan='2' valign='top'><div align='center'>$PRICE2</div></td> <td colspan='3' valign='top'><div align='center'>$PRICE3</div></td> </tr> <tr> <td height="19" colspan='7' valign='middle'><hr /></td> </tr> <tr> <td colspan='2' align="center" valign='middle'>$IMAGE4</td> <td colspan='2' align="center" valign='middle'>$IMAGE5</td> <td colspan='3' align="center" valign='middle'>$IMAGE6</td> </tr> <tr> <td width="68" valign='top'>$LINK4</td> <td width="69" valign='top'>$LINK4a</td> <td width="61" valign='top'>$LINK5</td> <td width="60" valign='top'>$LINK5a</td> <td width="86" valign='top'>$LINK6</td> <td width="63" valign='top'>$LINK6a</td> </tr> <tr> <td colspan='2' align="center" valign='top'>$TITLE4</td> <td colspan='2' align="center" valign='top'>$TITLE5</td> <td colspan='3' align="center" valign='top'>$TITLE6</td> </tr> <tr> <td colspan='2' valign='top'><div align='center'>$PRICE4</div></td> <td colspan='2' valign='top'><div align='center'>$PRICE5</div></td> <td colspan='3' valign='top'><div align='center'>$PRICE6</div></td> </tr> </table> as you can see there are two rows and three columns of products. right now I only have 6 products so everything fits well, but when I add more products I will need to add pagination but I wont open that can of worms until I get this resolved. thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/187434-while-loop-form-dynamic-table-with-3-columns/ Share on other sites More sharing options...
Catfish Posted January 6, 2010 Share Posted January 6, 2010 how does a single record's data relate to the static data you've shown? Does each record have 3 images, 6 links, 3 titles and 3 prices that you want to display over 4 rows? Quote Link to comment https://forums.phpfreaks.com/topic/187434-while-loop-form-dynamic-table-with-3-columns/#findComment-989803 Share on other sites More sharing options...
jrobles Posted January 6, 2010 Author Share Posted January 6, 2010 each record has one image, one price, one name, and two links based on the id i.e. product.php?id=1 cart.php?id=1 Quote Link to comment https://forums.phpfreaks.com/topic/187434-while-loop-form-dynamic-table-with-3-columns/#findComment-989813 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.