這個PDO插入語句沒有任何理由在MySQL中插入嗎?PDO語句沒有插入
$stmt = $dbh->prepare("INSERT INTO training courseId = :postCourse, title = :postCourseName, startDate = :postStartDate, endDate = :postEndDate");
$stmt->bindParam(':postCourse', $postCourse);
$stmt->bindParam(':postCourseName', $postCourseName);
$stmt->bindParam(':postStartDate', $postStartDate);
$stmt->bindParam(':postEndDate', $postEndDate);
$stmt->execute();
我沒有得到任何錯誤。一切對我來說都是正確的。
錯誤的SQL INSERT語法。它應該是這樣的:'INSERT INTO tbl(col1,col2,...)VALUES(:val1,:val2 ...)' – bfavaretto
@bfavaretto不正確,是,錯,可疑...... http:// dev .mysql.com/doc/refman/5.5/en/insert.html –