Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在cakephp中执行此查询_Sql_Cakephp - Fatal编程技术网

Sql 如何在cakephp中执行此查询

Sql 如何在cakephp中执行此查询,sql,cakephp,Sql,Cakephp,您知道如何使用助手find在cakephp中执行此查询吗 $req = "SELECT * FROM brand WHERE nom LIKE '$nom%' AND genre LIKE '$genre%' AND mouvement LIKE '$mouvement%' AND forme LIKE '$forme%' AND prix >

您知道如何使用助手find在cakephp中执行此查询吗

$req = "SELECT * FROM brand 
        WHERE nom LIKE '$nom%'  AND 
              genre LIKE '$genre%' AND     
              mouvement LIKE '$mouvement%' AND 
              forme LIKE '$forme%' AND 
              prix >= '$mini' AND 
               prix <= '$maxi' 
         ORDER BY prix ASC";
提前感谢您的回复;-)

试试这个

$this->Brand->find('all',array
(
    'conditions' => array
    (
        'Brand.nom LIKE' => "{$nom}%",
        'Brand.genre LIKE' => "{$genre}%",
        'Brand.mouvement LIKE' => "{$mouvement}%",
        'Brand.forme LIKE' => "{$forme}%",
        'Brand.prix >=' => $mini,
        'Brand.prix <=' => $maxi
    ),
    'order' => array('Brand.prix' => 'ASC')
));
$this->Brand->find('all',数组
(
“条件”=>数组
(
'Brand.nom LIKE'=>“{$nom}%”,
'Brand.genre LIKE'=>“{$genre}%”,
'Brand.movement LIKE'=>“{$movement}%”,
'Brand.forme LIKE'=>“{$forme}%”,
“Brand.prix>=”=>$mini,
“品牌大奖赛
$this->Brand->find('all',array
(
    'conditions' => array
    (
        'Brand.nom LIKE' => "{$nom}%",
        'Brand.genre LIKE' => "{$genre}%",
        'Brand.mouvement LIKE' => "{$mouvement}%",
        'Brand.forme LIKE' => "{$forme}%",
        'Brand.prix >=' => $mini,
        'Brand.prix <=' => $maxi
    ),
    'order' => array('Brand.prix' => 'ASC')
));