Well Im building a sort of catagory heirachry system for units. The way it works is: There are top units which have the unit_heiarchy id (in mysql) of 0. The units that fall under that have a catagory heircharchy of 1 (the 1 signifies the unit ID (Primary key) of the top unit). That repeats basically
So when I run this query in phpMyAdmin I get all the units I want:
(Remember the $id var here is the ID of the top unit you clicked on)
Code: Select all
$sql = $db->sql_query("SELECT unit_banner, unit_name, designation, unit_heirarchy, id FROM atfcs_units WHERE unit_heirarchy = $id ORDER BY id ASC");Code: Select all
while ($row = $db->sql_fetchrow($sql)){
echo "<img src='" . $row['unit_banner'] . "' />" . '<br />';
echo "<b><a href='modules.php?name=" . $module_name . "&op=roster&id=" . $row['id'] . "'>" . $row['unit_name'] . '</a></b> - <i>' . $row['designation'] . '</i><br />';Thanks for the great work here:)