Re: Model query for controller to view results

2011-01-21 Thread cricket
On Fri, Jan 21, 2011 at 4:06 AM, OldWest wrote: > Ok. Can you recommend a proper way of doing this or show a tutorial on this? > I read the manual on fetching data, but it does not give examples of > controllers using model queries (that I could find). It looks as if you're trying to fetch record

Re: Model query for controller to view results

2011-01-21 Thread Amit Badkas
Hi, I think you need to set parameters for pagination, please have a look at http://book.cakephp.org/view/1232/Controller-Setup Hope this helps. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Fri, Jan 21, 2011 at 2:36 PM, OldWest wrote: > Ok. Can you recommend a proper

Re: Model query for controller to view results

2011-01-21 Thread OldWest
Ok. Can you recommend a proper way of doing this or show a tutorial on this? I read the manual on fetching data, but it does not give examples of controllers using model queries (that I could find). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out

Re: Model query for controller to view results

2011-01-21 Thread Amit Badkas
Hi, You are fetching active records in $active variable but that variable is not being used anywhere. That's why the paginated results are not affected. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Fri, Jan 21, 2011 at 2:27 PM, OldWest wrote: > Ok the error is gone now

Re: Model query for controller to view results

2011-01-21 Thread OldWest
Ok the error is gone now, but for some reason the results are not being effected? I am calling it like so in my Controller: function search() { $this->Plan->recursive = 2; //*** Modified by Jason: Recursion needs to be corrected with better method. ***// *$active = $this->Plan->getActive();* $t

Re: Model query for controller to view results

2011-01-21 Thread OldWest
Still throwing the same error. I tried several variations: function getActive() { $conditions = array( 'limit' => 10, array('order' => array('monthly_cost ASC')), 'conditions' => array('PlanDetail.active' => 1) ); return $this->find('all', compact('conditions')); } --

Re: Model query for controller to view results

2011-01-21 Thread Amit Badkas
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->fin

Re: Model query for controller to view results

2011-01-21 Thread Jeremy Burns | Class Outfit
Your order statement is incorrect. Try this instead: array('order' => array('monthly_cost ASC')) Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 21 Jan 2011, at 08:34, OldWest wrote: > I am continuing to get an SQL error, and my query is NOT working??? > War

Re: Model query for controller to view results

2011-01-21 Thread Unflexible
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 wi

Model query for controller to view results

2011-01-21 Thread OldWest
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 synta