I been working on this for 3 days now
I have a db table with cid, pid, Title
cid = category id
pid = parent category id
I load that table in an array looking like (see below: This is what I got)
I like to sort and intend (see below: “This is what I need”)
Then I will load them in to form select option fields (I can do that)
This is what I need:
CID,PID,Title:
1,0,INDEX
2,1,-AFL
6,2,--Function
8,6,---Basic price pattern detection
9,6,---Composites
10,6,---Date/Time
11,6,---Indicators
12,6,---Information / Categories
13,6,---Lowest/Highest
14,6,---Math functions
15,6,---Miscellaneous functions
16,6,---Moving averages, summation
17,6,---Statistical functions
18,6,---String manipulation
19,6,---Trading system toolbox
20,6,---Exploration /Indicator Builder
21,6,---File Input/Output functions
22,6,---Referencing other symbol data
23,6,---Time Frame functions
7,2,--Plug-in
24,7 ---Quotes Plus
25,7 ---Interactive Brokers
3,1,-PHP
5,3,--PHP / mySQL
4,1,-mySQL
This is what I got:
(
[0] => Array
(
[0] => 1
[cid] => 1
[1] => 0
[pid] => 0
[2] => INDEX
[Title] => INDEX
)
[1] => Array
(
[0] => 2
[cid] => 2
[1] => 1
[pid] => 1
[2] => AFL
[Title] => AFL
)
[2] => Array
(
[0] => 3
[cid] => 3
[1] => 1
[pid] => 1
[2] => PHP
[Title] => PHP
)
[3] => Array
(
[0] => 4
[cid] => 4
[1] => 1
[pid] => 1
[2] => mySQL
[Title] => mySQL
)
[4] => Array
(
[0] => 5
[cid] => 5
[1] => 3
[pid] => 3
[2] => PHP / mySQL
[Title] => PHP / mySQL
)
[5] => Array
(
[0] => 6
[cid] => 6
[1] => 2
[pid] => 2
[2] => Function
[Title] => Function
)
[6] => Array
(
[0] => 7
[cid] => 7
[1] => 2
[pid] => 2
[2] => Plug-in
[Title] => Plug-in
)
[7] => Array
(
[0] => 8
[cid] => 8
[1] => 6
[pid] => 6
[2] => Basic price pattern detection
[Title] => Basic price pattern detection
)
[8] => Array
(
[0] => 9
[cid] => 9
[1] => 6
[pid] => 6
[2] => Composites
[Title] => Composites
)
[9] => Array
(
[0] => 10
[cid] => 10
[1] => 6
[pid] => 6
[2] => Date/Time
[Title] => Date/Time
)
[10] => Array
(
[0] => 11
[cid] => 11
[1] => 6
[pid] => 6
[2] => Indicators
[Title] => Indicators
)
[11] => Array
(
[0] => 12
[cid] => 12
[1] => 6
[pid] => 6
[2] => Information / Categories
[Title] => Information / Categories
)
[12] => Array
(
[0] => 13
[cid] => 13
[1] => 6
[pid] => 6
[2] => Lowest/Highest
[Title] => Lowest/Highest
)
[13] => Array
(
[0] => 14
[cid] => 14
[1] => 6
[pid] => 6
[2] => Math functions
[Title] => Math functions
)
[14] => Array
(
[0] => 15
[cid] => 15
[1] => 6
[pid] => 6
[2] => Miscellaneous functions
[Title] => Miscellaneous functions
)
[15] => Array
(
[0] => 16
[cid] => 16
[1] => 6
[pid] => 6
[2] => Moving averages, summation
[Title] => Moving averages, summation
)
[16] => Array
(
[0] => 17
[cid] => 17
[1] => 6
[pid] => 6
[2] => Statistical functions
[Title] => Statistical functions
)
[17] => Array
(
[0] => 18
[cid] => 18
[1] => 6
[pid] => 6
[2] => String manipulation
[Title] => String manipulation
)
[18] => Array
(
[0] => 19
[cid] => 19
[1] => 6
[pid] => 6
[2] => Trading system toolbox
[Title] => Trading system toolbox
)
[19] => Array
(
[0] => 20
[cid] => 20
[1] => 6
[pid] => 6
[2] => Exploration /Indicator Builder
[Title] => Exploration /Indicator Builder
)
[20] => Array
(
[0] => 21
[cid] => 21
[1] => 6
[pid] => 6
[2] => File Input/Output functions
[Title] => File Input/Output functions
)
[21] => Array
(
[0] => 22
[cid] => 22
[1] => 6
[pid] => 6
[2] => Referencing other symbol data
[Title] => Referencing other symbol data
)
[22] => Array
(
[0] => 23
[cid] => 23
[1] => 6
[pid] => 6
[2] => Time Frame functions
[Title] => Time Frame functions
)
[23] => Array
(
[0] => 24
[cid] => 24
[1] => 7
[pid] => 7
[2] => Quotes Plus
[Title] => Quotes Plus
)
[24] => Array
(
[0] => 25
[cid] => 25
[1] => 7
[pid] => 7
[2] => Interactive Brokers
[Title] => Interactive Brokers
)
)