gayu_justin has asked for the wisdom of the Perl Monks concerning the following question:
My requirement is, i want to map some checklist values to some groups. following is my code @selectbox1 => contains the selected select groups @selectbox2 => contains selected checklist
how can i assign the current value of the array to a varible?so that i can insert it into mapping tableforeach $select1(@selectbox1){ my $sql_select1 = "select id from group_management where group_name = +'$select1'"; my $box1 = $dbslave -> prepare($sql_select1); $box1 -> execute(); while($select_box1= $box1->fetchrow_array()) { push (@box1,$select_box1); } my $box_1 = @box1;// currently i tried like this to store the current +value .NEED CORRECTION HERE foreach $select2(@selectbox2) { my $sql_select2 = "select id from checklist where checklist_name = '$s +elect2'"; my $box2 = $dbslave -> prepare($sql_select2); $box2 -> execute(); while($select_box2 = $box2->fetchrow_array()) { push (@box2,$select_box2); } my $box_2 = @box2;// currently i tried like this to store the current +value .NEED CORRECTION HERE my $sql_insert = "insert into checklist_group_mapping values ('',$box_ +2,$box_1)"; my $ins = $dbslave -> prepare($sql_insert); $ins -> execute(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: want to store the current value of the array ina variable inside for loop
by rjt (Curate) on Jul 06, 2013 at 12:06 UTC | |
by gayu_justin (Novice) on Jul 06, 2013 at 12:20 UTC | |
|
Re: want to store the current value of the array ina variable inside for loop
by Anonymous Monk on Jul 06, 2013 at 12:09 UTC |