지난 두 시간 동안 열심히 읽고 코드를 실행했습니다. 하지만 SQL 쿼리에서 구문 오류가있어, 아무도 도와 줄 수 있습니까?잡히지 않은 PDOException : SQLSTATE [42000] - 데이터 삽입 시도
내 코드 :
$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 }
치명적인 오류 :
BTWUncaught 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)'
, 내가 어떻게 PHP 코드-태그를 사용할 수 있습니까?
감사