Answer the question
In order to leave comments, you need to log in
How can I organize such execution of a PDO query with bind_param?
There is a query to the database:
$stmts = $this->db->prepare("SELECT user_id FROM usersSettings WHERE ?=?");
$stmts->bind_param("ss", $method,$percent);
Answer the question
In order to leave comments, you need to log in
The third parameter in bind_param is the data type of the $method parameter. What do you have in this variable?
Do you want it to be like this?
Try this - remove the third parameter.
$stmts = $this->db->prepare("SELECT user_id FROM usersSettings WHERE ?=?");
$stmts->bind_param("ss", $method);
PDO cannot parameterize table and field names. Those. WHERE constructs? = ? or SELECT * FROM :table won't work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question