multidimensional array or another easier way???
Posted: Wed Dec 03, 2003 1:24 pm
I have two arrays: $exArray and $sgArray.
$exArray contains groups like 5, 6,7, 8. and $sgArray contains subgroups like a, b, c, d, e, f, g.
Now heres where it get tricky. Group 5 has three subgroups a, b, c, d. and Group 6 has e, f, g.
How do I parse through the two array so that I can insert into the database the subgroups of that particular group? I was thinking something like $exArray[5]=array(a,b,c,d), etc...
anyone else with some thoughts about this??
I have done this in PL/SQL and javascript, but not too sure about PHP as I am new to it... but heres what I was thinking atleast in PL/SQL
htp.p(' <SCRIPT LANGUAGE = "JavaScript"> ');
htp.p(' // creating multidimensional array to hold ');
htp.p(' // the FY and max week per the AP ');
htp.p(' ');
htp.p(' // Populating Array with PL/SQL ');
htp.p(' var ArrayWK = new Array() ');
FOR curWKrec in curWKTYPE LOOP
vcnt := vcnt + 1;
IF vcnt = 1 then
htp.prn('ArrayWK['||curWKrec.fy||']=[-1,'||curWKrec.max_wk );
ELSE
IF curWKrec.fy != v_fy THEN
htp.p(']; ');
htp.prn('ArrayWK['||curWKrec.fy||']=[-1,'||curWKrec.max_wk );
ELSE
htp.prn(','||curWKrec.max_wk);
END IF;
END IF;
v_fy := curWKrec.fy ;
END LOOP;
htp.p(']; ');
$exArray contains groups like 5, 6,7, 8. and $sgArray contains subgroups like a, b, c, d, e, f, g.
Now heres where it get tricky. Group 5 has three subgroups a, b, c, d. and Group 6 has e, f, g.
How do I parse through the two array so that I can insert into the database the subgroups of that particular group? I was thinking something like $exArray[5]=array(a,b,c,d), etc...
anyone else with some thoughts about this??
I have done this in PL/SQL and javascript, but not too sure about PHP as I am new to it... but heres what I was thinking atleast in PL/SQL
htp.p(' <SCRIPT LANGUAGE = "JavaScript"> ');
htp.p(' // creating multidimensional array to hold ');
htp.p(' // the FY and max week per the AP ');
htp.p(' ');
htp.p(' // Populating Array with PL/SQL ');
htp.p(' var ArrayWK = new Array() ');
FOR curWKrec in curWKTYPE LOOP
vcnt := vcnt + 1;
IF vcnt = 1 then
htp.prn('ArrayWK['||curWKrec.fy||']=[-1,'||curWKrec.max_wk );
ELSE
IF curWKrec.fy != v_fy THEN
htp.p(']; ');
htp.prn('ArrayWK['||curWKrec.fy||']=[-1,'||curWKrec.max_wk );
ELSE
htp.prn(','||curWKrec.max_wk);
END IF;
END IF;
v_fy := curWKrec.fy ;
END LOOP;
htp.p(']; ');