Welcome Guest, Not a member yet? Register   Sign In
I'm getting 3 errors (Undefined offset, trying to get property of non-objetc,... Please help
#1

[eluser]Aladin[/eluser]
Hello,
I'm trying to create a website with 3 type of membership, but when I added a code to the login function it puzzled me with 3 errors:

Quote:Message: Undefined offset: 1 (line 34)
Message: Trying to get property of non-object (line 34)
Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Projects\Avocats\system\core\Exceptions.php:170)
Filename: helpers/url_helper.php

Line Number: 543

This is the code:
Code:
function login_process($login, $pass)
    {
        $sql = $this->db->get_where('avocats', array('login'=>$login, 'pass'=>$pass));
        if($sql->num_rows()==0) return false;
        else
        {
            $result = $sql->result();
            $avocatID = $result[0]->id;
            $avocatStatus = $result[1]->status;
                        
            if($avocatStatus=="pfp") redirect('espace_avocat/compte_pfp');
            if($avocatStatus=="pending") redirect('espace_avocat/compte_p');
            if($avocatStatus=="active")    return $avocatID;
            else
            {
                redirect('membres/inscription_avocat');
            }
        }
Thank you in advance and sorry if any english mistake I'm francophone.

EDIT 1
Line 34 is
Code:
$avocatStatus = $result[1]->status;


Messages In This Thread
I'm getting 3 errors (Undefined offset, trying to get property of non-objetc,... Please help - by El Forum - 07-09-2011, 11:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB