Unable to locate the model you have specified error |
[eluser]Shannon[/eluser]
I am trying to make a login page from a tutorial. Whenever I submit the form, it says it can't locate the model I am trying to access. membership_model.php Code: <?php login.php Code: <?php I can't really know how to explain it, so if you can ask me questions to try manipulate the problem I will be more than happy to answer them. Also, today is my first day using CI. Thanks, Shannon.
[eluser]jzmwebdevelopement[/eluser]
Shannon, Have you loaded your model at all?
[eluser]Shannon[/eluser]
What do you mean have I loaded my model at all? Not sure what you mean. Can you explain it a little more please. EDIT: Yes, I have loaded it in the first line of the validate_credentials function.
[eluser]jzmwebdevelopement[/eluser]
[quote author="Shannon" date="1311504566"]What do you mean have I loaded my model at all? Not sure what you mean. Can you explain it a little more please. EDIT: Yes, I have loaded it in the first line of the validate_credentials function.[/quote] Shannon, CI has a very specific user guide have a read here: http://ellislab.com/codeigniter/user-gui...odels.html Jess
[eluser]Wondering Coder[/eluser]
why don't you try loading your model in the __contruct() so even if refresh or accessing other function in same controller it will be readily available.
[eluser]jzmwebdevelopement[/eluser]
[quote author="Shannon" date="1311504566"]What do you mean have I loaded my model at all? Not sure what you mean. Can you explain it a little more please. EDIT: Yes, I have loaded it in the first line of the validate_credentials function.[/quote] You have Code: $this->load->model('membership_model'); Code: $this->load->model('Membership_model');
[eluser]Aziz Chouhan[/eluser]
hi shannon all i read about your post i found some mistaken concepts. like 1. you make your model looking correct,but it can work perfectly when it calls from a controller. 2. make a controller which is called when a page is submitted to the server 3. in that controller a. first load your model $this->load->model('Membership_model'); b. then call your model function $this->Membership_model-> validate() that you have done in your code 4. all before your code ,you are missing this in you model code function __construct() { // Call the Model constructor parent::__construct(); } this is very important,and always use this,ok now i think your code will run successfully. for full help of code reply me enjoy
[eluser]Aken[/eluser]
Yeah, your loading code is fine, but you need the __construct() function to call parent::__construct(), as Aziz said.
[eluser]Shannon[/eluser]
I'm getting a ton of errors now, I can't even get back to my login page. |
Welcome Guest, Not a member yet? Register Sign In |