Insert into table with prepared statement
I'm trying to insert data from a form into a database using PHP and Mysqli
but I can't get it working! My database has 4 fields: DATE, TITLE,
CONTENT, ID. The ID field is auto-increment.
I've checked the connection and that's working fine. I've also echoed the
form field values and the $blogDate variable I created, they're all fine
too.
Here's my prepared statement:
if ($newBlog = $mysqli->prepare('INSERT INTO Blog VALUES ($blogDate,
$_POST["bTitle"], $_POST["bContent"])')) {
$newBlog->execute();
$newBlog->close();
}
It's just not inserting the values into my table.
No comments:
Post a Comment