Clarification of Question by
universityresource-ga
on
05 Nov 2004 16:16 PST
Here are the items you requested. The relationships between data
items in Table1 (GoodOrgPerson) are stored in Table2
(GoodOrgPRelations). The order of retrieval we are looking for is
from the top through each element linking to the bottom, Then up to
the nearest junction, across, and so-on.
CREATE TABLE `DataSite`.`GoodOrgPersonCopy` (
`Entry_id` int( 10 ) NOT NULL AUTO_INCREMENT ,
`User_ID` int( 10 ) default '0',
`Name` varchar( 150 ) NOT NULL default '',
`Position` varchar( 150 ) default '',
`Description` text,
`Image` blob,
`Image_type` varchar( 255 ) default '',
`Notes` text,
`Created` timestamp( 14 ) NOT NULL ,
PRIMARY KEY ( `Entry_id` ) ,
KEY `Name` ( `Name` ) ,
KEY `User_ID` ( `User_ID` )
) TYPE = MYISAM ;
INSERT INTO `GoodOrgPersonCopy` ( `User_ID` , `Name` , `Position` ,
`Description` , `Image` , `Image_type` , `Notes` )
VALUES ( 101, 'Course # and Name', 'Professor', 'Course Objectives',
NULL , '', NULL ) , ( 101, 'Title', 'Your Name', 'Executive
Summary\r\n\r\nExplain why the research was done, the findings and
what they mean, also what action or policy your results support.
\r\nor\r\nA nontechnical quick overview. \r\nor\r\nA preview that
sells you and your work, entices the reader to begin, the editor to
buy, the producer to produce.', NULL , '', NULL ) , ( 101, '1st Major
Point', '', '', NULL , '', NULL ) , ( 101, '2nd Major Point', '', '',
NULL , '', NULL ) , ( 101, '3rd Major Point', '', '', NULL , '', NULL
) , ( 101, 'Conclussion', '', '', NULL , '', NULL ) , ( 101,
'Introduction', '', '', NULL , '', NULL ) , ( 101, 'supporting
material', '', '', NULL , '', NULL ) , ( 101, 'supporting material',
'', '', NULL , '', NULL ) , ( 101, 'supporting material', '', '', NULL
, '', NULL ) , ( 101, 'supporting material', '', '', NULL , '', NULL )
, ( 101, 'supporting material', '', '', NULL , '', NULL ) , ( 101,
'supporting material', '', '', NULL , '', NULL )
// note that I have set User_ID to 101 in all the User_ID fields. In
the php these are populated by $_SESSION["USER_ID"]
CREATE TABLE `DataSite`.`GoodOrgPRelationsCopy` (
`Relation_id` int( 10 ) NOT NULL AUTO_INCREMENT ,
`User_ID` int( 10 ) default '0',
`Superior` int( 10 ) NOT NULL default '0',
`Subordinate` int( 10 ) NOT NULL default '0',
`RelationType` varchar( 150 ) default '',
`Description` varchar( 255 ) default NULL ,
`Notes` varchar( 255 ) default NULL ,
`Created` timestamp( 14 ) NOT NULL ,
PRIMARY KEY ( `Relation_id` ) ,
KEY `Superior` ( `Superior` ) ,
KEY `Subordinate` ( `Subordinate` ) ,
KEY `User_ID` ( `User_ID` )
) TYPE = MYISAM ;
INSERT INTO `GoodOrgPRelationsCopy` ( `User_ID` , `Superior` ,
`Subordinate` , `RelationType` , `Description` , `Notes` )
VALUES ( 101, 1, 2, '', NULL , NULL ) , ( 101, 2, 3, '', NULL , NULL )
, ( 101, 2, 4, '', NULL , NULL ) , ( 101, 2, 5, '', NULL , NULL ) , (
101, 2, 6, '', NULL , NULL ) , ( 101, 2, 7, '', NULL , NULL ) , ( 101,
3, 8, '', NULL , NULL ) , ( 101, 3, 9, '', NULL , NULL ) , ( 101, 4,
10, '', NULL , NULL ) , ( 101, 4, 11, '', NULL , NULL ) , ( 101, 5,
12, '', NULL , NULL ) , ( 101, 5, 13, '', NULL , NULL )
// Again User_ID has been populated with 101, and in php would be
populated by $_SESSION["USER_ID"]
The values for Superior and Subordinate are filled in however these
relate to GoodOrgPerson.Entry_id data that we inserted above, so we
have to retrieve the Entry_id of the inserted data.