一部の情報は PHP フォーム経由でこのページに送信されますが、公開するとこのエラーが発生します...
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 '-code) VALUES ('','$title','$description','$post','$author','11th September 20' at line 1
これがなぜなのか知っている人はいますか?
<?php
$description = addslashes($_POST[description]);
$post = addslashes($_POST[post]);
$title = addslashes($_POST[title]);
$date_posted = date("jS F Y");
$con=mysqli_connect("localhost","root","********","**********");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO posts
(id, title, description,
post, author, date_posted,
category, image-code)
VALUES
('','$_POST[title]','$_POST[description]',
'$_POST[post]','$_POST[author]','$date_posted',
'$_POST[category]','$image')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "Draft Successfully Submitted!";
mysqli_close($con);
header("Location:queue.php");
?>