$param = $posts['cnv_post_id']; //$posts['cnv_post_id']holds the current post id
$comments = $this->post_model->get_comments($param);在模型中:-
public function get_comments($cnv_post_id)
{
$get_comments =
$this->db->query('select * from cnv_comment where blog_tbl='.$cnv_post_id.'');
if($get_comments->num_rows > 0)
return $get_comments->result_array();
}但是如果我显式地指定$param = ' 100‘,其中100是当前的帖子id。
发布于 2014-01-23 22:33:33
下面是从表单中获取帖子的方法:
$param = $this->input->post('cnv_post_id');尝试输出$this->db->last_query()并将其提供给我们
发布于 2014-01-23 22:46:30
你试试吧。
$param = $this->input->post('cnv_post_id'); //$posts['cnv_post_id']holds the current post id
$comments = $this->post_model->get_comments($param);
public function get_comments($cnv_post_id)
{
$get_comments =
$this->db->query("select * from cnv_comment where blog_tbl = '$cnv_post_id'");
if($get_comments->num_rows() > 0)
return $get_comments->result_array();
}https://stackoverflow.com/questions/21311037
复制相似问题