私の要件は、いくつかのチェックリストの値をいくつかのグループにマップしたいということです。以下は私のコードです:
@selectbox1 => contains the selected select groups
@selectbox2 => contains selected checklist
コード:
foreach $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 = '$select2'";
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();
}
}
配列の現在の値を変数に割り当てて、マッピング テーブルに挿入できるようにするにはどうすればよいですか?