Welcome Guest, Not a member yet? Register   Sign In
DB bug?
#1

[eluser]stuffradio[/eluser]
Here is a basic library I was trying to start with in CI 2.1.

Code:
<?php

class Authentication
{

    function loginUser($username, $password)
    {
        $CI =& get_instance();
        $CI->load->model('Users','userobj');

        $match = $CI->userobj->isMatchingUserPassword($username, $password);

            if ($match == TRUE):

            // if the requested user exists in the database and the password matches with the username, the user is authenticated.
            return TRUE;
            else:
            return FALSE;
            endif;
    
    }


}

If you look at these lines
Code:
$CI->load->model('Users','userobj');

        $match = $CI->userobj->isMatchingUserPassword($username, $password);
it works fine, but if I try those same lines like this:
Code:
$CI->load->model('Users');

        $match = $CI->users->isMatchingUserPassword($username, $password);
It gives me an undefined property error for $users. What gives? The model file name is users.php.




Theme © iAndrew 2016 - Forum software by © MyBB