Yii Framework Forum: Insert Database In Heirarchical Order From Yii To Database(Mysql) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Insert Database In Heirarchical Order From Yii To Database(Mysql) Rate Topic: -----

#1 User is offline   jasonban 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-May 12

Posted 16 January 2013 - 12:30 AM

Hello Yii friends ..I am writing php script in Yii to insert the hierarchical database(mysql) from form. for example i have chapter 18 which contain section 18.1. where 18.1 may also have subsection 18.1.1 and again where 18.1.1 also may have 18.1.1.1, 18.1.1.2 and so on. after finishing chapter 18 again. I can do the similar for chapter 19,20 and so on..Well I am still trying but could not figure out the solution properly.

I was wondering if any of you friends have done it or know it. I will be really thankful.

database should store the value in similar order.

id --- section_num -- parent_section_id
1 --- 18.1 ---- ----- --- -- 0
2 -- - 18.1.1 -- ----- --- -- 1
3 -- - 18.1.1.1 -- ------ --- -- 2
4 -- - 18.1.1.1.1 ----- --- -- 3
5 -- - 18.1.1.1.2 ---- --- -- 3
6 -- - 18.1.2 -------- --- -- 1
7 -- - 19.1 -------- --- -- 0


Thanks in Advance
Regards
Sundar
0

#2 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 589
  • Joined: 26-November 10
  • Location:Sialkot, Pakistan

Posted 16 January 2013 - 12:52 AM

Check

http://www.yiiframew...ysubcateogries/

Also

http://www.yiiframew...t-child-in-yii/
Cheers
PeRoChAk
Cheap Domain & Hosting - Web & App Design - Web Application Development

My Page
0

#3 User is offline   jasonban 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-May 12

Posted 16 January 2013 - 02:15 AM

View PostPeRoChAk, on 16 January 2013 - 12:52 AM, said:



Well thanks for your help.. I want make clear that I am not talking about url.I am saying I am writing my own code in Yii. so that I am expecting the code in where I want enter the Law. Where main is chapter and there is section and subsection under the chapter. as well as i wan to integrate even breadcrums..

Thanks
Sundar
0

#4 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 589
  • Joined: 26-November 10
  • Location:Sialkot, Pakistan

Posted 16 January 2013 - 03:07 AM

Got your point but my aim was that you can use it to do that.

What is actually happening?
Each of your section has a sub section as do the Categories.

What you actually need is that How you can get the Parent of a child to list there i.e.

Section 1
Section 1.1
Section 2
Section 2.1
Section 2.1.1

The functions by atanio will help you in doing that.

Suggestion
Redesign your table of sections as
id Section_name path parent_section
1  18           18        0
2  18.1         18.1      1
3  18.1.1       18.1.1    2

Cheers
PeRoChAk
Cheap Domain & Hosting - Web & App Design - Web Application Development

My Page
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users