Welcome Guest, Not a member yet? Register   Sign In
Creating basic Register (username/login/password)
#11

[eluser]jvicab[/eluser]
Another general suggestion:

Don't add a __construct() function to your class if you don't need to put any code on it. It will prevent you for forgetting to call the parent constructor or misspelling it.
#12

[eluser]jvicab[/eluser]
make sure the name of the file is usermodel.php and
also you are assuming you create a constructor but you don't. Actually you have a diferent function, I mean, __User is not a class constructor, it is just another functuion inside it. Contructor name should be the same name of the class (function User), or better (php 5) function __construct(). It should be like:

function __construct() // instead of __User
{
parent::__Controller();

$this->view_data['base_url'] = base_url();

$this->load->model('Usermodel');
}
#13

[eluser]jvicab[/eluser]
I made a mistake,

function __construct()
{
parent::__construct(); // instead of parent::__Controller();

$this->view_data[‘base_url’] = base_url();

$this->load->model(‘Usermodel’);
}
#14

[eluser]toymachiner62[/eluser]
Load your model in the register function instead of in the constructor.
#15

[eluser]terry101[/eluser]
ok on my model i changed it a little (took off __construct()

Code:
class Usermodel extends CI_Model {
    
        function __Usermodel() {
             parent::__Model();
        }
thanks for that advise.

I'm still getting the same error. any other ideas?
#16

[eluser]toymachiner62[/eluser]
No. I'm talking about in your Controller, load the model in the register function rather than in the constructor function.
#17

[eluser]jvicab[/eluser]
No, that is not right. You cannot name your consturctor like this. The constructor name is always __construct() regardless the name of the class, and the parent constructor should be called like parent::__construct().
Your problem is caused by one of two things: or you are not loading the model or you are but CI cannot link it based on the naming convention. Try to code your constructors (only if you need to put some code on it) the way I suggested (for controllers and models and any other class you intyent to extend):

class Somename extends Parentclass
{
function __construct()
{
parent::__construct();
// your code here
}
}
#18

[eluser]terry101[/eluser]
i'm confused, the register_user function is in 'usermodel'(i loaded that model)
Code:
$this->load->model('Usermodel');
#19

[eluser]toymachiner62[/eluser]
I said nothing about the register_user function. I said the "register" function.
#20

[eluser]jvicab[/eluser]
ok, give me one minute, I will copy the code you posted earlier with my modifications, ok?




Theme © iAndrew 2016 - Forum software by © MyBB