Quantcast

how access another table data in controller

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

how access another table data in controller

sooryender

how access another table data in controller

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: how access another table data in controller

Sipathi
class YourController extends AppController {

        public function index(){

              $anotherTable = $this->loadModel('Model');
              $anotherTable->find('all');

              /*
              .........................
              */
        }

}


Von: sooryender <[hidden email]>
An: [hidden email]
Gesendet: 14:13 Samstag, 18.August 2012
Betreff: how access another table data in controller


how access another table data in controller
--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 


--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: how access another table data in controller

Bharat Maheshwari
In reply to this post by sooryender
Simply use the model name in $uses in the top of controller and use wherever you want the model in the whole controller

$uses=array('Modelname');

function test(){
 $record= $this->Modelname->find();
}

On Saturday, August 18, 2012 5:43:24 PM UTC+5:30, sooryender wrote:

how access another table data in controller

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: how access another table data in controller

Jeremy Burns | Class Outfit
Use that with caution as it will stop the model accessing it's own table as you've changed the default behaviour with this command.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 20 Aug 2012, at 05:25:38, Bharat Maheshwari <[hidden email]> wrote:

Simply use the model name in $uses in the top of controller and use wherever you want the model in the whole controller

$uses=array('Modelname');

function test(){
 $record= $this->Modelname->find();
}

On Saturday, August 18, 2012 5:43:24 PM UTC+5:30, sooryender wrote:

how access another table data in controller

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Loading...