#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    355
    Rep Power
    11

    Check if tree branch has data


    I have a menu tree in a mysql database which I can display easily by a recursive php function

    INSERT INTO `car_nav` (`rowid`,`parent`,`name`) VALUES
    (1,NULL,'cars'),
    (2,1,'BMW'),
    (3,1,'VW'),
    (4,1,'Audi'),
    (5,2,'4WD'),
    (6,4,'coupe'),
    (7,3,'coupe'),
    (8,7,'4WD'),
    (9,3,'limousine'),
    etc...

    INSERT INTO `car_data` (`navid`,`details`) VALUES
    (5,'this car has...'),
    (5,'a luxury model for...'),
    (6,'another car for...'),
    etc...

    Is there a way in PHP to show only the branches who end in an entry from the car_data DB and leave out those who are blind?
    In above example all branches that origin from VW would be hidden, as there are no models assigned.
    Last edited by benwenger; February 16th, 2013 at 03:47 AM.

IMN logo majestic logo threadwatch logo seochat tools logo