KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using PDO and want to do something like this: $query = $dbh->prepare("SELECT * FROM :table WHERE :column = :value"); $query->bindParam(':table', $tableName); $query->bindParam(':column', $columnName); $query->bindParam(':value', $value); Will PDO allow me to bind the table name and the column name like this? It seems to allow it, but it puts quotes around my parameters even if I use PDO::PARAM_INT or PDO::PARAM_BOOL as the data type. If this won't work, how can I safely escape my variables so that I can interpolate them in the query?
Tags (comma-separated)
Save Edits
Cancel