> -----Original Message-----
> From: bernabe diaz [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 19, 2002 10:18 AM
> To: [EMAIL PROTECTED]
> Subject: variable interpolation
> 
> 
> 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 
         ^^
         This is a syntax error, no?

> some_key=$variable_")
> ............
> 
> then when I try to pass $variable_    to a SQL statment the value of 
> $variable_ was not passed
> so i can't fetch information fro the database.
> when i give the string to the SELECT statement  directly 
> every thing is 
> fine, is working, that's why
> I consider that it is a problem of interpolation of the variable .

We can't see what the contents of $variable_ are, so we can't
tell what the problem is. What *exactly* is being passed to the 
prepare() call?

IOW, try something like this:

   my $sql = "select * from foo where name=$variable_";
   print $sql, "\n";
   my $sth = $dbh->prepare($sql) or die $DBI::errstr;

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

Reply via email to