EvilVamp Posted October 19, 2007 Share Posted October 19, 2007 Hi there! I'm doing a redesign to my website but I'm having trouble designing a table. Basically, I want this kind of structure: ________________ | | | | Entry 1 | Entry 2 | |_______|________| | | | | Entry 3 | Entry 4 | |_______|________| | | | | Entry 5 | Entry 6 | |_______|________| Its a databse with game info in it, So I'd be putting an image, a paragraph and a link in each 'entry cell', thats the easy bit, but its getting two entries on a row that I'm stuck on. This is a link to the design so far: http://gamer.awardspace.co.uk/index3.php its the 'capsules' under 'recently added games' that I want to put the info into. Each capsule being a different game. I hope this makes sense! Any help is appreciated! Thanks! Quote Link to comment Share on other sites More sharing options...
simcoweb Posted October 19, 2007 Share Posted October 19, 2007 This code worked great for me. You can set the # of columns as well. I used it to display 2 columns of subcategories in table cells pulling from the MySQL database. // run query $sql = "SELECT * FROM subcategories WHERE cat_id='2'"; $results = mysql_query($sql) or die(mysql_error()); // display results $totalColumns = 2; $i = 1; echo "<table border='0' cellpadding='2'>"; while ($row = mysql_fetch_array($results)){ if ($i == 1) echo "<tr>"; echo "<td>"; echo "<a href='getcat.php?subcat_id=". $row['subcat_id'] . "'>" . $row['subcat_name'] . "</a>"; echo "</td>"; if ($i == $totalColumns) { echo "</tr>"; $i = 0; } $i++; } echo "</table>"; Quote Link to comment Share on other sites More sharing options...
EvilVamp Posted October 19, 2007 Author Share Posted October 19, 2007 Great thanks! It looks so simple hehe I'll try it now. Quote Link to comment Share on other sites More sharing options...
EvilVamp Posted October 19, 2007 Author Share Posted October 19, 2007 It works prefectly! Thanks very much Quote Link to comment Share on other sites More sharing options...
simcoweb Posted October 19, 2007 Share Posted October 19, 2007 Of course it works! Quote Link to comment 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.