At Wednesday, 6 June 2001, you wrote:
Many thanks for your help but it doesn't work. I don't know if I
am doing anything wrong of there is another problem. I send you complete
string I am using to execute SQL sentence:
my $sql_inserta="INSERT INTO $tabla (dia_alta,
mes_alta,
anno_alta,
$fields[3],
$fields[4],
$fields[5])
VALUES ('$mday', # it works
'$mon', # it works
'$year', # it works
'$postInputs{ $fields[3]}',
# (*)
'$postInputs{ 'apellido1'}',
# ok
'$postInputs{ 'apellido2'}')";
#ok
(*) If I type ...'$postInputs{ 'nombre'}, ... it works. I don't know
what is the problem.
>-----Mensaje original-----
>De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Enviado el: martes, 05 de junio de 2001 18:26
>Para: Simon McCaughey
>CC: mrodriguez; beginners
>Asunto: Re: Problems using hash.
>
>On Tue, 5 Jun 2001, [EMAIL PROTECTED] wrote:
>
>> 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.
>
>or just:
>
>print "('$postInputs{ $fields[3]}')";
>
>In other words, what the OP was originally doing with "('name')" is
>exactly the same thing that he needs to do with a variable.
>
>> You don't need the inner set of single quotes, and the outer set
>> must be escaped.
>
>Single quotes do not need to be escaped inside double quotes.
>
>--
>Ren Maddox
>[EMAIL PROTECTED]
>
Marcos Rodriguez
http://www.vampsecure.com
email:[EMAIL PROTECTED]