bory has asked for the wisdom of the Perl Monks concerning the following question:
What I want to insert in the database is the result of an html form. In the html form, for each element of the array @identifier i have a checkbox:if it's checked then I will insert that element in the database as Feature, if it's not checked i will insert as Bug in database. So I will have in @idfeat those elements from @identifier that are checked: example: @identifier=("A1","B1","C1","D1"); @idfeat=("A1","B1");this means that A1and B1 are checked in the html form so they are Feature: I want my database to look like this:for (my $eu=0;$eu<=(scalar(@identifier));$eu++){ foreach my $id(@idfeat) { if ($id eq $identifier[$eu]){ my $sth=$dbh->prepare("INSERT INTO dd VALUES('$identif +ier[$eu]','Feature')"); $sth->execute(); $sth->finish; } else {my $sth=$dbh->prepare("INSERT INTO dd VALUES('$i +dentifier[$eu]','Bug')"); $sth->execute(); $sth->finish; } } }
But in the way I do it it looks like this:A1 Feature B1 Feature C1 Bug D1 Bug
Thank you for your timeA1 Feature A1 Bug B1 Feature B1 Bug C1 Bug C1 Bug D1 Bug D1 Bug
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inserting in a database
by hmerrill (Friar) on Nov 24, 2003 at 13:59 UTC | |
|
Re: inserting in a database
by edoc (Chaplain) on Nov 24, 2003 at 14:02 UTC | |
|
Re: inserting in a database
by Taulmarill (Deacon) on Nov 24, 2003 at 13:57 UTC | |
by Anonymous Monk on Nov 24, 2003 at 14:19 UTC | |
by jeffa (Bishop) on Nov 25, 2003 at 13:20 UTC |