Hi! function getActive() { $conditions = array( 'limit' => 10, 'order' => array('PlanDetail.monthly_cost asc'), 'conditions' => array('PlanDetail.active' => 1) // Gets all active=1 plan_details. ); return $this->find('all', compact('conditions')); }
compare with own code 2011/1/21 OldWest <jason.wy...@gmail.com>: > I am continuing to get an SQL error, and my query is NOT working??? > > Warning (512): 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 > cake-php+unsubscr...@googlegroups.com 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php