function getname()
{
$this->load->model('user'); //load the user class
$data['member'] = $this->user->ar_getwhere();
$this->load->view('home_content_view', $data);
}
这是我的模特:
function ar_getwhere()
{
$this->db->select('');
$this->db->from('tbl_members');
$this->db->where('member_name',$this->input->post('member_name'));
$q = $this->db->get('');
if($q->num_rows() > 0)
{
$data = array();
foreach($q->result() as $row)
{
$data=$row;
}
return $data;
}
}
答案 0 :(得分:0)
我不知道你遇到了什么错误,但无论如何
您正在接收模型中的帖子数据?您应该在控制器中接收发布数据并将其发送到模型,然后捕获它的响应......您还应该发送整个响应。
function getname()
{
$this->load->model('user'); //load the user class
$data['member'] = $this->user->ar_getwhere($this->input->post('member_name'));
$this->load->view('home_content_view', $data);
}
function ar_getwhere($memberName)
{
$this->db->select('*');
$this->db->from('tbl_members');
$this->db->where('member_name',$memberName);
$q = $this->db->get();
if($q->num_rows() > 0)
{
return $q->result();
}
}
答案 1 :(得分:0)
$q = $this->db->select('*')->from('tbl_members')
->where('member_name', $this->input->post('member_name'))
->get();