codeigniter中的数据库记录提取问题 [英] database record fetch issue in codeigniter

查看:92
本文介绍了codeigniter中的数据库记录提取问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下方法。

$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。现在,它返回结果

but its not giving the results. but if I explicitly give $param = '100' where 100 is the current post id. now, its returning the results

推荐答案

这是从表单中获取帖子的方式:

This is how you get the post from a form:

$param = $this->input->post('cnv_post_id');






尝试输出 $ this - > db-> last_query()并提供给我们

这篇关于codeigniter中的数据库记录提取问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆