I’ve created a blog feature in MySQL/PHP and I’m trying to figure out why I get the following error message:
[CODE]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 ‘2007-03-09 15:03:02’, ‘Mark’)’ at line 5
Here’s my PHP code which is doing the SQL inserting statement.
[code=php]if (isset($_POST[‘submit’])) {
$blog_title = $_POST[‘blog_title’];
$blog_body = $_POST[‘blog_body’];
$blog_user = $_POST[‘blog_user’];
$today = date(“Y-m-d H:i:s”);
$sql_insert = “INSERT INTO blogs
(blog_title, blog_body, blog_date, blog_user)
VALUES
(‘$blog_title’, ‘$blog_body’, ‘$today’, ‘$blog_user’)”;
mysql_query($sql_insert)
or die(mysql_error());
header(“location: ../blog.php”);
}
The blog_body field is ‘text’ and the text it didnt like was using apostrophes ‘.
Any ideas or pointers would be great.
Thanks in advance.