Jump to content

Any hint about how to proceed to subsequent parent-child data


siddiquip

Recommended Posts

Hi ,I have the following two tables Files,FileFiles the definitions for which are as follows

DROP TABLE IF EXISTS `FileFiles`;

 

CREATE TABLE `FileFiles` (

  `Parent_Id` int(11) NOT NULL default '0',

  `Include_Id` int(11) NOT NULL default '0',

  PRIMARY KEY  (`Parent_Id`,`Include_Id`)

) TYPE=InnoDB CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;

 

/*Data for the table `FileFiles` */

 

insert  into `FileFiles`(`Parent_Id`,`Include_Id`) values (21,22),(22,23);

 

/*Table structure for table `Files` */

 

DROP TABLE IF EXISTS `Files`;

 

CREATE TABLE `Files` (

  `File_Id` int(11) NOT NULL auto_increment,

  `File_Type` tinyint(4) NOT NULL default '0',

  `File_Name` varchar(255) default NULL,

  `File_Version` varchar(255) default NULL,

  `File_Info` varchar(255) default NULL,

  `File_Server` int(11) default NULL,

  `File_Location` varchar(255) default NULL,

  PRIMARY KEY  (`File_Id`),

  UNIQUE KEY `File_Name` (`File_Name`,`File_Server`,`File_Location`)

) TYPE=InnoDB CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;

 

/*Data for the table `Files` */

 

insert  into `Files`(`File_Id`,`File_Type`,`File_Name`,`File_Version`,`File_Info`,`File_Server`,`File_Location`) values (1,1,'alcatel_osos_WMRM.props',NULL,NULL,3,'/opt/Omnibus/tsm/solaris2'),(2,1,'alcatel_osos_NZLRM.props',NULL,NULL,3,'/opt/Omnibus/tsm/solaris2'),(3,1,'lucent_g2itm1_sc.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(4,1,'lucent_g2itm2_sc.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(5,1,'mv36_ZEM1.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(6,1,'mv36_ZEM2.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(7,1,'mv36_ZEM3.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(8,1,'mv36_ZEM4.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(9,1,'mv36_NWAEM1.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(10,1,'mv36_NWAEM2.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(11,1,'mv36_NWAEM3.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(12,1,'mv36_NWBEM1.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(13,1,'mv36_NWBEM2.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(14,1,'mv36_NWBEM3.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(15,1,'mv36_NOEM1.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(16,1,'mv36_NOEM2.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(17,1,'mv36_NOEM3.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(18,1,'mv36_MEM1.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(19,1,'mv36_MEM2.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(20,1,'mv36_MEM3.props',NULL,NULL,3,'/opt/Omnibus/probes/solaris2'),(21,2,'mttrapd.rules',NULL,NULL,3,NULL),(22,3,'mttrapd.include.rules',NULL,NULL,3,NULL),(23,4,'mttrapd.lookup',NULL,NULL,3,NULL),(24,2,'huwaei.rules',NULL,NULL,3,NULL),(25,2,'mm.rules',NULL,NULL,3,NULL);

 

########################################################################

I have to build a page using php for files which will show all the files in the table files .Now it should be such that when i select a file and if its file_id is present in the FileFiles table (ie either parent_id or include_id) the file name should be shown from the files table  with subsequently all files in hierarchy . ie if 21 is selected then it should on clicking 21 show 22 which on subsequent clicking should show 23. similarly this should repeat for files 22 and 23 as follows

      21 <-22->23 and

  23->22->21

 

 

how can this be achieved .......any help is appreciated

please guys help me

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.