Recursive photo gallery removal problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I designed a photo gallery system, in which I allow users to create
recursive photo "folders."  The trouble I am having is being able to delete
a photo folder, and all folders/photos within it.

Example structure:

Main Folder
  - Folder 1
     - Folder a
     - Folder b
         - Folder i
         - Folder ii
           - Folder aa
               -Folder bb
  - Folder 2
      - Folder 2a
               ...

I am having trouble creating code to delete all folders within the folder
they choose to delete.

Say I want to delete "Folder b."  In addition to deleting "Folder b," the
code also needs to delete folders "Folder i," "Folder ii," "Folder aa," and
"Folder bb."

Here's how I've setup the photo gallery table:

CREATE TABLE `gallery` (
  `uniqueid` int(11) unsigned default NULL,
  `gallery` int(11) default NULL,
  `image` varchar(255) default NULL,
  `height` int(11) default NULL,
  `width` int(11) default NULL,
  `thumbnail` varchar(255) default NULL,
  `title` varchar(150) default NULL,
  `description` text,
  `location` int(11) unsigned default NULL,
  `uploaded_by` int(11) default NULL
) TYPE=MyISAM;

uniqueid is the id of the folder.
gallery is the folder depth (0=photo, 0=main folder, 1=sub folder level 1,
2==sub folder level 2...)
location is the folder this sub-folder is located in

Seems this code may be fairly complex.  I've made about three attempts, with
no success and I figured this would be the best place to ask.

Any help would be appreciated.

-Tom Reed
centrex@xxxxxxxxxxxxxx

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux