"Henrickson, Diana" wrote:
> I realize this may be a silly question but I cannot get this to work. I'm
> trying to pass form variables into a database using DBD::DB2..
>
> $sth = $dbh -> prepare ("INSERT INTO USERDATA(FIRST_NAME)
> VALUES($fdat{cgifirst})") or die "Cannot INSERT to '$table'" ;
>
> Is there a different way I need to reference my variables?
>
Occasionally I find I need to copy hash values to temp variables to get
things to work right.
my $cgifirst = $fdat{'cgifirst'};
$sth = $dbh->prepare ("INSERT INTO $table (FIRST_NAME)
VALUES('$cgifirst')"or die "Cannot INSERT to '$table'" ;
Otherwise I get some cryptic hash reference instead of the value. I
remember stumbling across an explanation of this somewhere. It had to
do with the evaluation of hash references in a string context. Of
course I can't find that information back right now. I don't believe
the problem has anything to do with Embperl or DBI though. It is
strictly a Perl thing I think.
Sorry I can't be more helpful.
Bryan.
--
Bryan Thale
Motorola Labs, Networking and Infrastructure Research
mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]