0

I have following query where interest is field name. interest contains like football,vollyball etc.

SELECT * FROM `drop_down_multiples` where find_in_set('football',`interest`);

I stuck to convert above query in CakePHP. How I can convert ?

Thanks.

1 Answer 1

1

Some thing like this :-

cakephp haven't any function for this,you have to do some tricks that how cakephp built the sql queries from their syntax.

$this->DropDownMultiples->find('all',array(
  'conditions'=>array('FIND_IN_SET("'.$search_field.'",DropDownMultiple.interest)‌​')
  ));
Sign up to request clarification or add additional context in comments.

16 Comments

What you mean by place_here_list?
You have to change something like this 'conditions'=>array('FIND_IN_SET("'.$search_field.'",DropDownMultiple.interest)')
@Sadikhasan In which interest field has to be searched
You are nearest the solution but you have to change your syntax of find_in_set I mentioned above
do you mean DropDownMultiple.interest having comma separated values.you should mention in the question.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.