Wardy_7 Posted October 25, 2007 Share Posted October 25, 2007 I have a database with products in and I want iT to automatically show every product on the page. Now I am able to do this easy enough but what I am struggling to do is that I want the products to be displayed in 3 columns. I can get them to display one under the other easy enough but I want them to be in rows with 3 columns instead. Can anyone please help. echo("<table>"); while($row = mysql_fetch_array($result)){ if ($bgcolor == "#F7DF42"){ $bgcolor = "#FFFFFF"; }else{ $bgcolor = "#F7DF42"; } echo("<tr bgcolor=".$bgcolor.">\n<td>"); echo('<a href="../products/' . $row["product_code"] . '">' . $row["description1"] . '</a>'); echo('<img src="' . $row["small_image"] . '" alt="' . $row["description1"] . ' ' . $row["description2"] . '"></a>'); echo("</td>\n"); } echo("</table>"); Cheers Wardy Quote Link to comment https://forums.phpfreaks.com/topic/74735-displaying-database-information-in-columns/ Share on other sites More sharing options...
pocobueno1388 Posted October 25, 2007 Share Posted October 25, 2007 Take a look at this post http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Quote Link to comment https://forums.phpfreaks.com/topic/74735-displaying-database-information-in-columns/#findComment-377796 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.