I’m trying to write a function that can alter the value of a column in a table, where the table, column, and values are not predetermined. Is it possible to do something like this:
UPDATE :tbl SET :column = :value;
to accomplish this, or can parameters only be bound for values?
EDIT:
Or is this the only way to accomplish this:
$query = "UPDATE".$tbl." SET ".$column." = ".$value.";";
It is not possible to do that. Prepared statements allow the database to optimize a query plan for the particular query. If it doesn’t know what table or column, it cannot create the query plan.