假设数据库已经连接成功,insert()方法是向留言表中插入留言记录,请阅读如下代码是否能执行,如能执行则返回什么,如果不能执行,请说出原因。 public function insert(){ $data['poster'] = $_POST['poster']; $data['mail'] = $_POST['mail']; $data['comment'] = $_POST['comment']; $data['date'] = date('Y-m-d H:i:s'); $data['ip'] = $_SERVER["REMOTE_ADDR"]; $sql = "insert into `comment` set "; foreach($data as $k=>$v){ $sql .= "`$k`='$v',"; } return $this->db->query($sql); }