Jump to content

sandersomers

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sandersomers's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello fellow php scripters, I am new to this forum, so please be easy on me. I don't have much experience, but i like to tell myself i do.  ;) I made a database driven navigation menu, or a folder structure menu... whatever you would like to call it. it's structure is quit easy. CREATE TABLE `file_manager` (   `id` int(11) NOT NULL auto_increment,   `menu_id` int(11) NOT NULL,   `menu_name` varchar(128) collate latin1_general_ci NOT NULL,   PRIMARY KEY  (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=138 ; So let's say i have 5 menu items and all items have several sub items.. I want to delete a item with sub items, here i get stuck with my loop.   $result = mysql_query("SELECT * FROM article_menu WHERE id='$is_the_first_item_to_delete'");   while($row = mysql_fetch_array($result)){   $result_sub = mysql_query("SELECT * FROM article_menu WHERE id='$row[menu_id]'");   while($row_sub = mysql_fetch_array($result_sub)){   mysql_query("DELETE FROM article_menu WHERE menu_id='$row_sub[id]'"); }   mysql_query("DELETE FROM article_menu WHERE menu_id='$is_the_first_item_to_delete'"); } This will only delete the first sub items, however i would like to have all sub items to be deleted. I have searched this site but i couldn't find anything useful. This could be caused by my searching skills. Hopefully one of you scripters could help me out. ???
×
×
  • 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.