You should check first whether your $someone array has a key "User"
before trying to access it:

http://php.net/manual/en/function.isset.php

This is a PHP issue, not a CakePHP one. :-)

On Mon, Jan 31, 2011 at 9:07 AM, sadeepap <[email protected]> wrote:
> Hi ,
>
> I am a new comer to Cake and has the following error message in one of
> my codes.
>
> Notice (8): Undefined index: User [APP\controllers
> \users_controller.php, line 28]
>
> Code at users_controller.php
>
> <?php
> class UsersController extends AppController
> {
>        var $name='Users';
>    var $uses = array('User');
>
>        function index(){
>
>        }
>
>        function register(){
>
>
>        }
>
>        function uploadcv(){
>
>
>        }
>
>        function login(){
>
>                $this->set('error',false);
>
>                if(!empty($this->data))
>                {
>                        // $someone=$this->User->findByUsername('alpha');
>                        
> $someone=$this->User->findByUsername($this->data['User']
> ['username']);
>                 if(!empty($someone['User']['password']) && $someone['User']
> ['password'] == $this->data['User']['password'])
> {
>                                $this->Session->write('User', 
> $someone['User']);
>                                $this->redirect('/clients');
>                 }
>                 else
>                 {
>                                                $this->set('error', true);
>                 }
>
>
>
>
>                }
>        }
>
>        function logout(){
>
>
>        }
> }
> ?>
>
> Can someone please help me ?
>
> --
> 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
> [email protected] 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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to