Project/산림박물관

메뉴 카테고리 XML PHP코드

꿈꾸는새벽별 2010. 4. 24. 11:26
이거 만드는데 힘들어 죽는줄 알았네..
그래도 해결해서 다행이다..

[ db_conn.php 코드 ]



[function.php 코드]



[Setting.php코드]




[ xml 구현 부분인 leftMenu.php코드]



그리고 메뉴 DB테디블은 재귀용법으로 포린키를 자신을 참조시킨 테이블을 생성시켜
값을 입력 시킨다...

머 대충 이런식이다...

CREATE TABLE category

(

    code INTEGER NOT NULL,

    part INTEGER NULL,

    name CHAR(18) NULL

);

 

ALTER TABLE category

ADD PRIMARY KEY (code);

 

ALTER TABLE category

ADD FOREIGN KEY R_1 (part) REFERENCES category (code);

 

 

 

insert into category values(1,null,'소품류');

insert into category values(2,null,'임산물');

insert into category values(3,null,'박제류');

insert into category values(4,null,'표본류');

insert into category values(5,null,'모형');

insert into category values(6,null,'패널');

insert into category values(7,null,'사진');

insert into category values(8,null,'민속생활용품');

insert into category values(9,null,'고서적');

insert into category values(10,null,'공예품');

insert into category values(11,null,'기타');

 

 

insert into category values(101,1,'나무');

insert into category values(102,1,'한지');

 

insert into category values(201,2,'목재');

insert into category values(202,2,'석재');

insert into category values(203,2,'화석');

 

insert into category values(301,3,'야생동물박제');

 

insert into category values(401,4,'곤충');

insert into category values(402,4,'토사');

insert into category values(403,4,'버섯');

insert into category values(404,4,'약용,씨앗');

insert into category values(405,4,'야생화 꽃누루미');

insert into category values(406,4,'파충류');

insert into category values(407,4,'석엽');

insert into category values(408,4,'종자');

insert into category values(409,4,'목재');

insert into category values(410,4,'나뭇잎');

insert into category values(411,4,'기타');

 

insert into category values(701,7,'야생화');

insert into category values(901,9,'서적류');

 

쿼리문

 

select A.name as First, B.name as Second, C.name as Third from

(select * from category where part is null) A left join

category B on A.code =B.part left join

category C on B.code = C.part;

 

============추가 쿼리문 ==========================

 

select A.name as First, A.code as Code, B.name as Second, C.name as Third from

(select * from category where part is null) A left join

category B on A.code =B.part left join

category C on B.code = C.part;

 

이상. 끝