Welcome Guest, Not a member yet? Register   Sign In
Problem finding Model
#1

[eluser]CRHayes[/eluser]
Hey everyone! I just dowloaded CI and started with it, but I have this error message:

Code:
An Error Was Encountered
Unable to locate the model you have specified: login_model

This is the code for the model:
Code:
<?php

class Login_model extends Model {
    
    function Login_model()
    {
        parent::Model();
    }

    function userLogin($username)
    {

        $result = $this->db->query("SELECT member_id, username, password, authority FROM member_profile WHERE username = '$username'");
        return $result;
    }
}

?>

This is the line in the controller loading the message:
Code:
$this->load->model('Login_model', '', TRUE);

And I have a Login_model.php saved in my models folder. I have NO idea whats wrong! I can't find documentation or help anywhere! Please help! lol
#2

[eluser]wiredesignz[/eluser]
maybe save as login_model.php

User Guide states: The file name will be a lowercase version of your class name.

I'm guessing thats it though.
#3

[eluser]xwero[/eluser]
have you loaded the database?
#4

[eluser]mistress_shiira[/eluser]
try to change it to:
Code:
$this->load->model('login_model');
#5

[eluser]wiredesignz[/eluser]
[quote author="xwero" date="1195825561"]have you loaded the database?[/quote]

Models don't require the database to load.
#6

[eluser]andreagam[/eluser]
Have you tried in lower case?

Rename the file in model directory to "login_model.php"
#7

[eluser]mistress_shiira[/eluser]
i edited my reply. see thread above.you dont need to rename your file to lowercase but use the lowercase
of your filename when loading it to the model like so:
Code:
$this->load->model('login_model');
#8

[eluser]xwero[/eluser]
[quote author="wiredesignz" date="1195826431"][quote author="xwero" date="1195825561"]have you loaded the database?[/quote]

Models don't require the database to load.[/quote]
If you load the database in your model i would agree with you but i don't see that in the example model.
Not loading the database can generate weird errors.

But it's not the solution for this problem. I join the others thinking the filename has to be in lowercase
#9

[eluser]thurting[/eluser]
If you have problems with CI_Loader just use a 'require' statement and the 'new' operator.
#10

[eluser]CRHayes[/eluser]
Alright thanks a lot everyone! I must have just skipped that statement in the user manual by mistake :S




Theme © iAndrew 2016 - Forum software by © MyBB