in reply to Re: DBI SQL Query Question
in thread DBI SQL Query Question
DBI always auto quotes placeholders. Which can be annoying if you want to use a placeholder to represent what you are selecting and not what you are comparing.
## You can do this, and not worry about quoting: $query = "SELECT x, y, z from table where a = ?"; ## This doesn't work the way you think it does: $query = "SELECT ? from table where a = 'blah'";
In the case of the second example above, if you provided "field1" to be bound to the placeholder, you would get: SELECT "field1" from table where a = 'blah', which means you would get a bunch of results that all say "field1".
|
|---|