2014-04-18 07:50 阅读 19


Hi I have a code in which I am sending a keyword in URL so when we click on link its going to our website so for that I am checking what keyword value is coming in URL in my controller

$keyword= $this->params['url']['keyword'];

$dUsers = $this->Db_user->find(

So my databse has keywod value like : ab ab,bc,ca ab,cd so what is happening by this its giving only ab keyword in result but I need all 3 result which have my keyword in DB so for it I tried to make it like


also tried:


But after it getting no results.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    doucong6884 doucong6884 2014-04-18 08:09

    Just use in your conditions array:

    'Db_user.area_of_expertise LIKE' => '%'.keyword.'%'
    点赞 评论 复制链接分享
  • dongmu1996 dongmu1996 2014-04-18 08:11

    You could be using the query method for your custom queries find reference below http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-query

    点赞 评论 复制链接分享