function recurseCategories($parent = 0, $count = 1) { $sql = 'SELECT * FROM store_categories WHERE categories_parent = ' . $parent . ' ORDER BY categories_title ASC'; for ($i = 0; $i <= $count; $i++) { $padding = 10 * $count; } $results = dbQuery($sql); while ($cInfo = dbFetchArray($results)) { echo "<tr>\n"; echo "<td class=\"row" . $row . "\"><a href=\"" . PAGE_STORE . "?section=products&action=manage&c=" . $cInfo['categories_id'] . "\" title=\"" . output($cInfo['categories_title']) . "Products\"><img src=\"images/icons/folder_closed_16x16.gif\" width=\"16\" height=\"16\" border=\"0\" /></a></td>\n"; echo "<td class=\"row" . $row . " pageTitleSub \"><img src=\"images/filler.gif\" width=\"" . $padding . "\" height=\"5\"> <a href=\"" . PAGE_STORE . "?section=products&action=manage&c=" . $cInfo['categories_id'] . "\" title=\"" . output($cInfo['categories_title']) . " Products\">" . output($cInfo['categories_title']) . "</a></td>\n"; echo "<td class=\"row" . $row . "\">" . date('m/d/Y', $cInfo['categories_date_added']) . "</td>\n"; echo "<td width=\"50\" class=\"row" . $row . "\"><a href=\"" . PAGE_STORE_CATEGORIES . "&action=editcategory&id=" . $cInfo['categories_id'] . "\" title=\"Edit " . output($cInfo['categories_title']) . "\" ><img src=\"images/icons/edit_16x16.gif\" width=\"16\" height=\"16\" border=\"0\" /></a> | <a href=\"" . PAGE_STORE . "?action=deletecategory&id=" . $cInfo['categories_id'] . "\" onclick=\"return confirm('Are you sure you want to delete " . $cInfo['categories_title'] . "?');\"><img src=\"images/icons/delete_16x16.gif\" width=\"16\" height=\"16\" border=\"0\" /></a></td>\n"; echo "</tr>\n"; recurseCategories($cInfo['categories_id'], $count + 1); } }
<td class="tableRowHeader" align="left">Created</td> <td class="tableRowHeader" width="50"> </td> </tr> <? $count = 0; $topLevelResults = dbQuery('SELECT * FROM store_categories WHERE categories_parent = 0 ORDER BY categories_title'); while($cInfo = dbFetchArray($topLevelResults)) { $row = $count % 2; echo "<tr>\n"; echo "<td class=\"row".$row."\"><a href=\"".PAGE_STORE."?section=products&action=manage&c=".$cInfo['categories_id']."\" title=\"".output($cInfo['categories_title'])."Products\"><img src=\"images/icons/folder_closed_16x16.gif\" width=\"16\" height=\"16\" border=\"0\" /></a></td>\n"; echo "<td class=\"row".$row." pageTitleSub\"><a href=\"".PAGE_STORE."?section=products&action=manage&c=".$cInfo['categories_id']."\" title=\"".output($cInfo['categories_title'])." Products\">".output($cInfo['categories_title'])."</a></td>\n"; echo "<td class=\"row".$row."\">".date('m/d/Y', $cInfo['categories_date_added'])."</td>\n"; echo "<td width=\"150\" align=\"right\" class=\"row".$row."\"><a href=\"".PAGE_STORE_CATEGORIES."&action=editcategory&id=".$cInfo['categories_id']."\" title=\"Edit ".output($cInfo['categories_title'])."\" ><img src=\"images/icons/edit_16x16.gif\" width=\"16\" height=\"16\" border=\"0\" /></a> | <a href=\"".PAGE_STORE."?action=deletecategory&id=".$cInfo['categories_id']."\" onclick=\"return confirm('Are you sure you want to delete ".$cInfo['categories_title']."?');\"><img src=\"images/icons/delete_16x16.gif\" width=\"16\" height=\"16\" border=\"0\" /></a></td>\n"; echo "</tr>\n"; recurseCategories($cInfo['categories_id'], 1); $count++; } ?> </table> </form></td> </tr> </table> <? break; case 'addcategory': case 'editcategory': if($_GET['action'] == 'addcategory') {