I have a simple blog created using php/mysql. When I create a post, the sql doesn't always insert the posted content from the blog post.
$blogTitle = $_POST[blogTitle];
$blogText = $_POST[blogText];
$blogTags = $_POST[blogTags];
$today = date("F j Y");
$createPostSQL = mysqli_query($con,"INSERT INTO blog_data (blog_title, blog_text, blog_date, blog_tags, popularity) VALUES ('$blogTitle', '$blogText', $today, '$blogTags', 10)");
if (!mysqli_query($con,$createPostSQL))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
}
I'm receiving the following mysqli_error which I can't make sense of.
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '16 2013, 'test', 10)' at line 1
Before anyone states some of the obvious solutions, let me state the following
- The connection to the database is fine.
- The information is being received by a POST from another page, which is also working fine.
- Besides the mysql_error stated above, the page is not receiving any other obvious errors.