douju6542 2013-07-12 06:20
浏览 8
已采纳

获取与给定输入匹配的名称

am using code as below.according to the review name the details are getting. what i require is if i give a particular word that is for example "san" for searching the names matching to that has to be displayed.that is sangee, santhosh,..... for you to understand example is facebook in which if we go to search and add some name it will be showing the names matching to that in the similar way we require the output for our app. the input should be dynamic. thanks

$this->db->select('reviewee_name');
$this->db->from('reviews');
$this->db->where('reviewee_name', $input['reviewee_name']);
$query = $this->db->get();
  • 写回答

2条回答 默认 最新

  • dongqin1819 2013-07-12 06:27
    关注

    Simply change

    $this->db->where('reviewee_name', $input['reviewee_name']);
    

    Into

    $this->db->like('reviewee_name', $input['reviewee_name']);
    

    Don't do this

    $this->db->like('reviewee_name', '%'. $input['reviewee_name'] .'%');
    

    It creates another % inside %, like this

    WHERE reviewee_name LIKE '%%reviewee_name%%'
    

    For more information visit http://ellislab.com/codeigniter/user-guide/database/active_record.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题