For some reason this throws a PDOException.
$stmt = $db->prepare('DELETE FROM ?');
$stmt->execute([$table]);
The error I get is "General error: 1 near "?": syntax error". I echoed $table
right before prepare
and it shows an existing table name.
I initialized $db
like this.
$db = new PDO("sqlite:my.db");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
I'm using PHP 5.4.4.