You are not conforming to Cake standards. So, whilst you could *probably* make 
it work your own way, you are miles better off following the guide.

In your example:

Your table should be called users (it should have a primary key called id)
Your model should be called User (in a file called user.php in the /app/models/ 
folder)
Your controller should be called UsersController (in a file called 
users_controller.php in /app/controllers)

See this page for more details: 
http://book.cakephp.org/view/901/CakePHP-Conventions

Also, follow these tutorials, which will take you through a basic application: 
http://book.cakephp.org/view/1527/Tutorials-Examples

Jeremy Burns
[email protected]


On 10 Mar 2010, at 12:47, nagendran wrote:

> 
> i am beginner to cake php. my table name is tbl_admin
> 
> i created one model with file name tbl_admin.php.
> 
> Model code:
> class Eego_tbl_admin extends AppModel
> {
> var $name = 'tbl_admin';
> 
> 
> function finduser()
> {
> //$ff=$this->query("select count(*) from tbl_admin where
> admin_username='admin'");
> 
> return $ff;
> }
> 
> 
> }
> 
> controller file name is user_controller.php
> 
> controller code
> 
> class UserController extends AppController {
> 
> 
> 
> function login()
> {
> echo $gg=$this->tbl_admin->finduser();
> }
> 
> }
> 
> my view page is login.php. it is in user folder.
> when i login page it showing the following error.
> 
> Notice (8): Undefined property: UserController::$tbl_admin
> [APP\controllers\user_controller.php, line 8]
> 
> Fatal error: Call to a member function finduser() on a non-object in
> C:\wamp\www\app_cake\app\controllers\user_controller.php on line 8
> 
> 
> what wrong in my code
> 
> -- 
> View this message in context: 
> http://old.nabble.com/pls-help-me-in-cake-php-model-method-tp27849150p27849150.html
> Sent from the CakePHP mailing list archive at Nabble.com.
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to