你知道如何使用帮助器查找在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";
我这样做但不起作用
$results=$this->Model->find('all',array('conditions'=>array
('AND'=>array('name LIKE'=>$nom,'genre LIKE'=>$genre,
'mouvement LIKE'=>$mouvement,.....))));
提前感谢您的回复; - )
答案 0 :(得分:1)
试试这个
$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')
));