Cynical Posted June 13, 2013 Share Posted June 13, 2013 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. Link to comment https://forums.phpfreaks.com/topic/279119-how-can-i-make-the-categories-display-in-list-style-instead-of-left-to-right/ 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> Link to comment https://forums.phpfreaks.com/topic/279119-how-can-i-make-the-categories-display-in-list-style-instead-of-left-to-right/#findComment-1435763 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.