Split PHP loop into 2 lists
问题 I have built the following function, but is it possible to get it to split my lists from one into more so I can have a maximum of 8 <li> 's per <ul> ? function buildProductsMenu($base) { $sql = "SELECT * FROM tbl_category"; $result = dbQuery($sql); while ($row = dbFetchAssoc($result)) { echo "<ul>"; echo "<li class='title'>$row[cat_name]</li>"; $sqlProd = "SELECT * FROM tbl_product WHERE cat_id = $row[cat_id]"; $resultProd = dbQuery($sqlProd); while ($rowProd = dbFetchAssoc($resultProd)) {