I prefer using a placeholder, you don't need to quote anything that way
which avoids mistakes.

my $sth = $dbh->prepare('SELECT something FROM some_table WHERE some_key =
?');
$sth->execute( CGI->param('NAME') );

Did you also print out the variable to prove that it does indeed contain
some data?  Do you also have the RaiseError attribute turned on to die if
there are any SQL errors?

Rob


-----Original Message-----
From: bernabe diaz [mailto:[EMAIL PROTECTED]]
Subject: variable interpolation

Thanks for help, but
I tried that way too, and it does not work.
BD

bob ackerman wrote:

>
> On Friday, April 19, 2002, at 07:18  AM, bernabe diaz wrote:
>
>> Hi everyone,
>> could somebody help me with the following problem:
>> i have a code something like that
>> my  $variable = CGI->param('NAME');
>> #making connection to database
>> .................................
>> my $variable_ =$dbh->quote($variable);
>> .........
>>
>> $sth = ->$dbh->prepare(" SELECT  something FROM some_table WHERE 
>> some_key=
>> $variable_")
>> ............
>
>
> i think you need to put single quotes around $variable_.
> $sth = ->$dbh->prepare(" SELECT  something FROM some_table WHERE 
> some_key=
> '$variable_' ");
<snip>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to