Cynical Posted June 13, 2013 Share Posted June 13, 2013 (edited) I have this piece of code but I'm unsure of how to make it sort in list style instead of left to right.. Example 1, How it is now: Category1 - SubCategory1 | Category1 - SubCategory2 | Row 3 | Row 4 | Row 5 | Category1 - SubCategory3 | Category2 - SubCategory1 | Row 3 | Row 4 | Row 5 Example 2, What I need it to do: Category1 - SubCategory1 | Category2 - SubCategory2 Category1 - SubCategory2 Category2 - SubCategory1 Column 4 Column 5 If anybody could guide me to some examples/tutorials or has any pointers it would be much appreciated. I tried looking at some SQL examples but all they showed me is what I've already done. <table align="center"> <tr align='right'> <?php $i = 0; $cats = SQL_Query_exec("SELECT * FROM categories ORDER BY parent_cat, name"); while ($cat = mysql_fetch_assoc($cats)) { $catsperrow = 5; print(($i && $i % $catsperrow == 0) ? "</tr><tr align='right'>" : ""); print("<td style=\"padding-bottom: 2px;padding-left: 2px\"><a href='categories.php?cat={$cat["id"]}'>".htmlspecialchars($cat["parent_cat"])." - " . htmlspecialchars($cat["name"]) . "</a> <input name='c{$cat["id"]}' type=\"checkbox\" " . (in_array($cat["id"], $wherecatina) || $_GET["cat"] == $cat["id"] ? "checked='checked' " : "") . "value='1' /></td>\n"); $i++; } Thanks in advance for any help. Edited June 13, 2013 by Cynical Quote Link to comment Share on other sites More sharing options...
Lukeidiot Posted June 13, 2013 Share Posted June 13, 2013 It seems you are sorting them with a table at the moment. to sort in list <ul><li>List item 1</li><li>List item 2</li> <li>List item 3</li> <li>List item 4</li></ul> 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.