in reply to Using variables in a DBI do queriy
Your placeholders do not match your number of fields. One way I avoid this is to always use the following syntax:
my $sth = $dbh->prepare("insert into foo SET source=?, name=?, date=?, + status=?"); $sth->execute('file', 'Ben marcata', '2001-05-04', '') or die $dbh->er +rstr;
Also note that you have a variable $values that you were wanting to use to include 2 different field values. This won't work as a single string, they must be passed separately.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using variables in a DBI do queriy
by vendion (Scribe) on May 04, 2011 at 19:47 UTC | |
by wind (Priest) on May 04, 2011 at 20:47 UTC | |
by vendion (Scribe) on May 05, 2011 at 14:26 UTC | |
by wind (Priest) on May 05, 2011 at 17:26 UTC | |
by vendion (Scribe) on May 05, 2011 at 18:14 UTC |