user2398182
user2398182

Reputation: 11

CakePHP Access database table

Suppose a table name of mysql database is 'admin' and controller name is 'userscontroller' and model name is 'user'.

How can I access the data from the table 'admin' in cakephp? Please explain with code.

Upvotes: 0

Views: 765

Answers (1)

Brett Stewart
Brett Stewart

Reputation: 478

This is probably not the best solution but What I would do is make a new Model called 'Admin' specifically for that table, then in the UserController Call it, example:

In the UserController

 $this->loadModel('Admin');
 $this->Admin->find('all');

In the Admin Model

 $useTable = 'admin';

Upvotes: 2

Related Questions