High_-_Tek Posted June 30, 2006 Share Posted June 30, 2006 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 basicallySo 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 themThanks for the great work here:) Quote Link to comment https://forums.phpfreaks.com/topic/13290-unit-heiarchy-issue/ Share on other sites More sharing options...
Barand Posted June 30, 2006 Share Posted June 30, 2006 Except for the closing } missing (typo?) the loop looks OK. Have you checked that $id contains the value you expect? Quote Link to comment https://forums.phpfreaks.com/topic/13290-unit-heiarchy-issue/#findComment-51196 Share on other sites More sharing options...
High_-_Tek Posted June 30, 2006 Author Share Posted June 30, 2006 Im going through a few tests right now, will report on results@Barand: I didnt post the whole loop Quote Link to comment https://forums.phpfreaks.com/topic/13290-unit-heiarchy-issue/#findComment-51200 Share on other sites More sharing options...
High_-_Tek Posted June 30, 2006 Author Share Posted June 30, 2006 Ok after some testing I have assured that the $id var passed in the URL is correctBut yet still, only 1 unit displays out of all of them Quote Link to comment https://forums.phpfreaks.com/topic/13290-unit-heiarchy-issue/#findComment-51203 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.