Is there any reason this PDO insert statement isn’t inserting in MySQL?
$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();
I’m not getting any errors. Everything looks correct to me.
Your query should be:
Or:
See http://dev.mysql.com/doc/refman/5.5/en/insert.html
You should be able to check for errors like this:
Or:
Or:
See: http://www.php.net/manual/en/pdo.error-handling.php