So my problem is that for some reason, the items do not appear to be going into my database:
$comment = $_POST['comment'];
if (isset($_POST['username']) or $_POST['username'] != '') {
$username = $_POST['username'];
mysql_query('Insert into comments VALUES (comment="'.$comment.'", username="'. $username.'")');
echo $username;
}
else {
mysql_query('insert into comments values (comment="'.$comment.'")');
}
My table is named comments, one field is named comment, and one field is named username.
What’s wrong with my code?
The SQL insert format is incorrect :-
Or
If you do a
var_dump(mysql_error());,you should able to see more verbose details on the error
Off-topic :-
You insert statement does not cater for sql injection,
https://stackoverflow.com/tags/php/info