I've been trying to fix this error for 2 hours, but no use. Here's my code:
$stmt = $conn->prepare("INSERT INTO posts (post_title, post_content, post_timestamp, post_author, post_intro, link, meta_k, meta_d) VALUES (?,?,?,?,?,?,?,?;");
$stmt->bind_param("ssisssss", $post_title, $post_content, $post_timestamp, $post_author, $post_intro, $link, $meta_k, $meta_d);
$stmt->execute();
This has been answered many times on here. The problem in your instance is that you have a typo in your query:
$stmt = $conn->prepare("INSERT INTO posts (post_title, post_content, post_timestamp, post_author, post_intro, link, meta_k, meta_d) VALUES (?,?,?,?,?,?,?,?;");
should be:
$stmt = $conn->prepare("INSERT INTO posts (post_title, post_content, post_timestamp, post_author, post_intro, link, meta_k, meta_d) VALUES (?,?,?,?,?,?,?,?)");
// typo is at the carat: ^
there is an extra ';' in your VALUES()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.