function add_comment() { $user_id = $this->input->post('user_id'); $post_id = $this->input->post('post_id'); $comment_description = $this->input->post('post_description'); $this->load->model("Comment_m"); $comment = new Comment_m(); $comment->add_comment($user_id, $post_id, $comment_description); }
function add_comment() { $user_id = $this->session->userdata('userId'); $post_id = $this->input->post('post_id'); $comment = $this->input->post('comment'); $this->load->model("Comment_m"); $comment_m = new Comment_m(); if ($user_id) { $comment_m->add_comment($user_id, $post_id, $comment); } else { echo "error"; } }