Thanks Jeff!
That licked it.
Yours
Jin Kee
> Thuan-Jin Kee wrote:
>
>>$code = <<MARKER;
>>INSERT INTO customer
>>(custID, family, given)
>>VALUES
>>(1, " . $dbh->quote("adams") . ", " . $dbh->quote("mortica") . ");
>>MARKER
>>
>>$dbh->do($code)
>> or die "Cannot prepare: " . $dbh->errstr();
>>
>>
>
> There are several minor problems with this code. In the first place,
> your SQL statement ends with a semicolon. Most DBDs do not like
> semicolons at the end of statements, they expect to get a statement
> without a semicolon at the end, so just omit it. Seondly, you have put
> the database handle object ($dbh) inside a quoted string - it is between
> the <<MARKER and MARKER so it gets treated as a string, not an object.
> You also are adding unneeded quotes onto $dbh->quoted values. I
> recommend instead that you use placeholder syntax like this:
>
> $code = <<MARKER;
> INSERT INTO customer
> (custID, family, given)
> VALUES (?,?,? )
> MARKER
>
> $sth=$dbh->prepare($code)
> or die "Cannot prepare: " . $dbh->errstr();
> $sth->execute(1,'adams','morticia');
> or die "Cannot execute: " . $sth->errstr();
>
> When I made those changes to your code, it worked fine for me.
>
> --
> Jeff
>