I have made a comment section for my gallery , but not sure sure why only able to do 1 comment on it then it wont allow me to execute any more comment on that item
the insert
public function insertComment() {
if(!get_magic_quotes_gpc()) {
$this -> sanitizeInput();
}
extract($_POST);
$name = $_SESSION['userName'];
$comment = $_POST['comment'];
$productID = $_GET['id'];
echo $name;
echo $comment;
echo $productID;
$qry = "INSERT INTO comments VALUES (NULL, '$name', '$comment', '$productID' )";
$rs = $this -> db -> query($qry);
if($rs && $this -> db -> affected_rows > 0) {
$msg = 'comment record created. ';
} else {
echo 'Error inserting comment';
}
return $msg;
}
tables
Field Type Collation Attributes Null Default Extra Action
id int(11) No None auto_increment
name varchar(150) latin1_swedish_ci No None
comment varchar(150) latin1_swedish_ci No None
productID int(11) No None
maybe this will work
$qry = "INSERT INTO comments (name, comment, productID) VALUES ('$name', '$comment', '$productID' )";
remove the null