I keep getting this:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''
TABLE 16
''
But i can't find the error in my code:
$show = $conn->query('SHOW TABLES');
$show->setFetchMode(PDO::FETCH_NUM);
while($row = $show->fetch()) {
$tbl = "`".$row[0]."`";
$trunc = $conn->prepare('TRUNCATE TABLE :tbl');
$trunc->bindParam(':tbl', $tbl, PDO::PARAM_STR, 64);// sanitize data
$trunc->execute();
}
If i change it like this,it work:
$trunc= $conn->query('TRUNCATE TABLE `TABLE 16`');