如何在CakePHP分页条件中转换mysql查询

时间:2014-10-15 16:26:32

标签: php mysql cakephp pagination cakephp-2.0

我在MySQL以下查询。 我只想在CakePHP分页条件下转换MySQL查询。这样我就能得到结果。

MySql查询:

SELECT *, 3963 * acos(cos(radians(90-lat ))*cos(radians(90-'".$result['lat']."'))".
"+sin(radians(90-lat ))* sin(radians(90-'".$result['lat']."'))".
"*cos(radians(lng- '".$result['lng']."'))) AS distance FROM member"." HAVING (distance < 5) ORDER BY distance ASC

我正在使用此PHP代码

$condition = array('Member.is_deleted !=' => 1, 'Member.status !='  => 0, 'OR' => array());


$this->paginate = array(
                    'conditions' => $condition,
                    'fields' => array()                 
                );

0 个答案:

没有答案