I'm trying to implement a comment.php script that takes the data from a html textfield and save it to a database in phpmyadmin. I implemented registration.php, which is longer and it inserts new users flawlessly. Now the comment.php, which is simpler is not adding anything to a comments table.
Here's the code for comment.php:
<?php
session_start();
require('connect.php');
$id = $_SESSION['id'];
$comment = $_POST['comment'];
$sql = "INSERT INTO `comp595ose`.`comments`
(`id`, `comment`)
VALUES
(NULL, \'This is not working\');";
$add_comment = mysql_query($sql);
echo $comment." ";
echo $id;
?>
the 'comments' table in myphpadmin has only two field, id(autoincrement) and comment.