Ich lese und versuchte in den letzten zwei Stunden, meinen Code auszuführen. Aber ich habe einen Syntaxfehler in meiner SQL-Abfrage, kann mir jemand helfen?Uncaught PDOException: SQLSTATE [42000] - Versuchen Sie, Daten einzufügen
Mein Code:
$query = "INSERT INTO `article` (`text`,`headline`,`date`,`author`,`active`) SET (?,?,?,?,?)";
$stmt = $pdo->prepare($query);
$stmt->bindValue(1, $text, PDO::PARAM_STR);
$stmt->bindValue(2, $headline, PDO::PARAM_STR);
$stmt->bindValue(3, $date, PDO::PARAM_STR);
$stmt->bindValue(4, $author, PDO::PARAM_STR);
$stmt->bindValue(5, $active, PDO::PARAM_INT);
if($stmt->execute()) { //do something }
Fatal error:
Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET ('some text','test headline','2017-09-30','author123',1)'
btw, wie ich PHP-Code-Tags verwenden?
Dank