Hi,

Following should be the correct way

function getActive()
{
    $findParameters = array(
        'limit' => 10,
        'order' => array('PlanDetail.monthly_cost' => 'asc'),
        'conditions' => array('PlanDetail.active' => 1) // Gets all active=1
plan_details.
    );

    return $this->find('all', $findParameters);
}

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 21, 2011 at 2:04 PM, OldWest <[email protected]> wrote:

> I am continuing to get an SQL error, and my query is NOT working???
>
> *Warning* (512) 
> <http://cda-insurance.com.w3developing.com/pre/cake/beta/plans/search>: *SQL 
> Error:* 1064: You have an error in your SQL syntax; check the manual that 
> corresponds to your MySQL server version for the right syntax to use near 
> 'order = ('asc') AND conditions = (1)' at line 1
>
>
> Here is my code:
>
> *Plan Controller* Method search()
>
> function search() {
> $this->Plan->recursive = 2; //*** Modified by Jason: Recursion needs to be
> corrected with better method. ***//
>  $active = $this->Plan->*getActive()*;
> $this->set('plans', $this->paginate());
> } // Trying to get $active to return to my results, but nothing is
> happening at all except the above error and ALL results (query is not
> effective).
>
> *Plan Model *Method search()
>
> function getActive() {
>       $conditions = array(
>         'limit' => 10,
>         'order' => array('monthly_cost' => 'asc'),
>  'conditions' => array('PlanDetail.active' => 1) // Gets all active=1
> plan_details.
>     );
>       return $this->find('all', compact('conditions'));
>    }
>
> Anyone know why this is not working?
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to