Jump to content

Unit Heiarchy Issue


High_-_Tek

Recommended Posts

Time for a tucker!

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)

$sql = $db->sql_query("SELECT unit_banner, unit_name, designation, unit_heirarchy, id FROM atfcs_units WHERE unit_heirarchy = $id ORDER BY id ASC");

But when I run that in PHP, I only get the top set. with this code:

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 />';

Am I missing something herea about the code repitition in the while()?

On using a print_r on $row I only get 1 unit instead of all of them

Thanks for the great work here:)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.