How to bind table in PDO?

Works (but then we don't bendim table)
$table = 'job';
$st = $pdo->prepare(' SELECT COUNT(*) FROM '.$table.' WHERE uid=:uid ');

$table = 'job';
$st = $pdo->prepare(' SELECT COUNT(*) FROM `table` WHERE uid=:uid ');
$st->bindParam(':table', $table);

Error: table not found SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bd.'job" doesn't exist'

$table = 'job';
$st = $pdo->prepare(' SELECT COUNT(*) FROM table WHERE uid=:uid ');
$st->bindParam(':table', $table);

Parse error: SQLSTATE[42000]: Syntax error or access violation right syntax to use near "job' WHERE uid=...

My imagination has dried up...
July 9th 19 at 11:27
1 answer
July 9th 19 at 11:29

Find more questions by tags PHP PDOPHP