MySQL version: 5.0.51b-community-nt
Error given: "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 ')' at line 1"
At the moment, I've been wrestling with this code for quite a while. I want it to show a simple form when $_POST isn't set (and for some reason, it's always set, so I've used $_POST[date]) and when it is set, write $_POST[date] and $_POST[content] to the relevant places in the sql table. For some reason, it's failing now, and I'm well and truly stuck.
<?php
$html = "<html><head></head><body><p><form action=\"newspost.php\" method=\"post\">Datemarker: <input type=\"text\" name=\"date\" />Content: <input type=\"text\" name=\"content\" /><input type=\"submit\" /></form></p></body></html>";
if($_POST[date] == "")
{
echo $html;
}
if(isset($_POST))
{
echo $_POST[date];
$con = mysql_connect("localhost","user","pass");
mysql_select_db("sg194", $con);
$date194 = $_POST[date];
$content194 = $_POST[content];
$query = "INSERT INTO frontpage_news (date,content) VALUES (".$date194.",".$content194.")";
mysql_query($sql, $con);
mysql_close($con);
}
?>
Apologies if this is in the wrong section.