我不确定此代码不能工作,所以任何帮助将不胜感激。Codeigniter加入搜索
我想搜索一个用户用户名,并显示他们的角色名称,这是存储在配置文件表中。
$search = $_POST['search'];
$this->db->join('user_profiles', 'user_profiles.id = users.id');
$this->db->like('username',$search);
$this->db->or_like('user_profiles.character_name',$search);
$data['users'] = $this->db->get('users');
该网页似乎没有任何错误,火精,但无论怎样我输入到搜索,我得到0的结果。
解决:代码没有错,它是我的表单验证。
你能运行'echo $ this-> db-> last_query();'并且添加运行到你的问题的实际查询吗? –
这帮助我解决了这个问题,我的表单验证规则破坏了一切。谢谢! –
很高兴帮助。我是否可以发表我的评论作为答案,或者您是否会发布您的解决方案? –