apu has asked for the wisdom of the Perl Monks concerning the following question:
I've obviously been staring at my code too long and I need a second pair of eyes...
my $dbfieldlist = join ", ", @fields; my $dbfielddata = join ", ", map { $dbh->quote($_) } $form->field; my $insert = $dbh->prepare( INSERT into $DBTABLE ($dbfieldlist) VALUES ($dbfielddata) ); $insert->execute();
$form->field contains a hashref of field/values from CGI::FormBuilder. So the above code is inserting the field names into the database instead of inserting the values into the corresponding columns.
What am I missing?
Thanks in advance, Monks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Map hashref to get values?
by Eliya (Vicar) on Mar 07, 2012 at 23:40 UTC | |
by apu (Sexton) on Mar 07, 2012 at 23:44 UTC | |
by aaron_baugher (Curate) on Mar 08, 2012 at 01:44 UTC | |
by apu (Sexton) on Mar 08, 2012 at 04:29 UTC | |
by Eliya (Vicar) on Mar 07, 2012 at 23:50 UTC |