Is there something wrong with my query?
function needExport($table, $key, $id, $stamp) {
try {
$dbW = dbConCC();
$stmt = $dbW->prepare("SELECT * FROM :table LIMIT 10");
$params = array(':table' => "tmlaender");
$stmt->execute($params);
while ($row = $stmt->fetch()) {
echo $row;
}
}
catch(PDOException $e) {
echo json_encode($e->getMessage());
}
}
I get the follwoing Syntax Error:
"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 ''tmlaender' LIMIT 1' at line 1"
Can't find any mistakes in this "simple" query.