From: Northstardomus <[EMAIL PROTECTED]>
> ...
> $dbh->prepare('INSERT INTO area_status (areaID, survey_date,
> update_time, status ) VALUES (?,?,?,?)');
> $dbh->execute('$values[0]', '$values[1]', '$values[2]',
> '$values[3]');
Apart from the $sth already explained by others, there is one more
problem with this code. It seems you already found it as it is not
present in the examples you give in the later posts, but I'd like to
point it out anyway.
You cannot use singlequotes around the $values[x] in the ->execute()
call. You'd insert not the values in the @values array, but the
literal dollar, "values", opening square brace, one and closing
brace. Try
@values = (1,2,3,4);
print $values[1], "\n";
print '$values[1]', "\n";
Just for reference, you should not use doublequotes around them
either:
$dbh->execute("$values[0]", "$values[1]", "$values[2]",
"$values[3]");
While this would work (in this case) it forces perl to make copies of
the values and possibly also an unnecessary number->string
conversion. I only mention this because I see things like this quite
often.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/