converting simple query to cake query?

前端 未结 3 1283
悲&欢浪女
悲&欢浪女 2021-01-28 20:05

Actually I have 1 query but I am unable to convert it into CakePHP query format.

$result = \"select 
             * from esl_userresults
           where 
               


        
3条回答
  •  悲哀的现实
    2021-01-28 20:49

    Use Containable behaviour rather than recursive. It will give you control down to individual field level. Using it now, at an early stage, will make it second nature later.

    If you get confused building the conditions, build it outside the method call.

    Try to avoid the use of double quotes except where you need to include escaped or parsed data - they're slower.

    $conditions = array(
        'EslUserresult.esl_songID' => 'EslLyric.id',
        'EslLyric.song_name LIKE' => '%'.$esl_keyword.'%'
                       )
    $this->EslUserresult->contain('EslLyric.text');
    $result = $this->EslUserresult->find('all',array('conditions'=>$conditions));
    

提交回复
热议问题