0

I'm trying to set the table name in my sql statement in PHP

$stmt = $pdo->prepare("SELECT count(*) FROM ?");
$stmt->execute([$table]);
$count = $stmt->fetchColumn();

with what i tried i get: Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation If you know any solution to pass the table name in php it'll be very helpful! thanks in advance!

0 Answers0