I have the following snippet of code;
function addComment($id) {
global $db;
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
$query = "INSERT INTO comments " . "VALUES{$_POST['name']}'," . "'{$_POST['rating']}'," . "'{$_POST['comment']}";
mysql_query($query);
echo "<div class=\"content-left-box\"><div class=\"left\">Success!</div><div class=\"right\"></div><div class=\"clear\"></div></div>";
echo "<div class=\"content-left-box-none\">";
echo "Your comment has been posted, thanks! Click <a href=\"{$_SERVER['PHP_SELF']}" . "?action=show&id=$id\">here</a> to go back and see it.";
echo "</div>";
unset($_SESSION['security_code']);
}
else {
echo "<div class=\"content-left-box\"><div class=\"left\">Error</div><div class=\"right\"></div><div class=\"clear\"></div></div>";
echo "<div class=\"content-left-box-none\">";
echo "Your comment has not been posted. Please <a href=\"{$_SERVER['PHP_SELF']}" . "?action=show&id=$id\">go back</a> and fill in all of the required fields.";
echo "</div>";
}
}
Pastebin version just in case.
It throws up no errors, works perfectly, just simply dosen't insert the data into the database. The weird thing is, when I remove all traces of the rating part, it works just fine. Not a clue why, although I am absoloutley shattered. Spend last night watch gangster films, lol. Goodfellas is fantastic. Anyway, any ideas?