Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Variable is filled with column name not data, can't figure out why.

by grep (Monsignor)
on Jul 17, 2007 at 03:20 UTC ( #626956=note: print w/ replies, xml ) Need Help??


in reply to Variable is filled with column name not data, can't figure out why.

Straight from the DBI Docs:

With most drivers, placeholders can't be used for any element of a statement that would prevent the database server from validating the statement and creating a query execution plan for it. For example: "SELECT name, age FROM ?" # wrong (will probably fail) "SELECT name, ? FROM people" # wrong (but may not 'fail')

So you'll need to change your code to:

$sth = $dbh->prepare(qq~select $rating from FanRatings where Title = ? +~) or die $DBI::errstr; $sth->execute($filename) or die $DBI::errstr;

Comment on Re: Variable is filled with column name not data, can't figure out why.
Select or Download Code
Re^2: Variable is filled with column name not data, can't figure out why.
by Eagle_f90 (Acolyte) on Jul 17, 2007 at 23:02 UTC
    Now that you point that out I remember reading it last week when learning about the place holders. It just never poped back to me as the problem. Thanks for the help!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626956]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-12-19 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (71 votes), past polls