Ok, after poking around all the PHP resources I came up with this code that seems to be working.
PHP Code:
$parentid = 0; // assuming that 0 is the main category.
get_sub_cats($parentid);
function get_sub_cats($parentid) {
$sql = "SELECT * FROM myTable WHERE parentID = ".$parentid."";
$run = mysql_query($sql);
echo '<ul>';
while ($rec = mysql_fetch_assoc($run)) {
echo '<li />', $rec['Name'];
get_sub_cats($rec['id']);
}
echo '</ul>';
}
Now I'm wondering if this is the most efficient way to do this. This code is so simple that I'm afraid that I'm creating a repeating query that's going to slow down when the file count goes way up. The parent child list that I am building will grow to thousands of parent child lists that go 10 generations deep or more.
If anyone has an idea of how to more efficiently do this I'd love to hear about it. For now this gets another page done and I'm one more day toward a paycheck.