Your problem seems to be in the use of single quotes see my example code:

$fields[3]="x";
$postInputs{'x'}= "the_test";

print "('$postInputs{ '$fields[3]'}')";
print "(\'$postInputs{ $fields[3]}\')";


try that.

You don't need the inner set of single quotes, and the outer set must be
escaped.

Its all to do with string interpolation, $x=10; then
print $x; #prints 10
print "$x"; #also prints 10
print '$x'; #prints $x

Simon

----- Original Message -----
From: Marcos Rodriguez <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 05, 2001 1:22 PM
Subject: Problems using hash.


> Hi all,
>
> I am working on a program and I am trying to do I show below.
>
> %postInputs = readPostInput();
>
> # readPostInput() is a function that return correct values.
>
> my $sql_inserta="INSERT INTO $tabla ($fields[3]) VALUES
postInputs{ 
> '$fields[3]'}')";
> 
> # if I use this sentence when I try to execute the INSERT it inserts 
> blanks
> 
> # $fields[3] = name
> # if I use my $sql_inserta="INSERT INTO $tabla ($fields[3]) VALUES 
> ('name')"; it works
> 
> Can anyone help and say me how can I use ...('$postInputs{ '$fields[3]'}')";
> 
> 
> Many thanks in advance.
> 
> Best regards,
> 
> 
> Marcos Rodriguez
> http://www.vampsecure.com
> email:[EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> 


Reply via email to