I am implementing prepared statements with dynamic parts like so
$stmt = $db->prepare("SELECT * FROM" .$table. "WHERE id=? AND name=?");
The "table" part is dynamic , is a variable that contains the name of the table. For now it is inserted by the code, but what if in the future I decide to have the user insert it?
How can I secure against injection a variable that is not part part of the WHERE part of the statement?
Thanks