我为我的画廊做了一个评论部分,但不确定为什么只能对它做 1 条评论,然后它就不允许我对该项目执行任何评论
插入
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;
}
表
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