I want to use my variables in my mysql queries safely. Im using pdo for this. But i can't use pdo placeholders for table name.
This works;
$stmt = $db->prepare("SELECT * FROM table WHERE id=?");
$stmt->execute(array($id));
But this doesnt;
$stmt = $db->prepare("SELECT * FROM ? WHERE id=?");
$stmt->execute(array($table, $id));
What i'm doing wrong ?