Welcome Guest, Not a member yet? Register   Sign In
Problem loading up model
#1

[eluser]sakamofo[/eluser]
I'm having so much trouble loading up a model. I'm really new at CodeIgniter, this is my first time working with a PHP framework.
Currently, my main model has this inside it:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Register extends CI_Model {

    public function registerUser() {    
        $insert = array(
           // Database key => value pairs
        );
        $this->db->insert('user', $insert);
    }
}

?>

And inside my controller, I have this:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Registration extends CI_Controller {
    
    public function index() {    
        $this->load->helper(array('form', 'url'));
        $this->load->library(array('form_validation', 'encrypt', 'session'));
                    
        $config = // ...array validation rules...
        $this->form_validation->set_rules($config);
            
               // Perform validation check
        if ($this->form_validation->run() == false)
        {    $this->load->view('failure');
                } else {
            $this->load->model('Register', '', TRUE);
            $this->Register->registerUser();
            $this->load->view('success');
        }
        
    }
} ?>


But for some reason it's not loading anything up even when no validation errors occur and if there's a view file being loaded; just a blank page. I've loaded the model the same as the documentation/user-guide but it's not working for me. When I take out the model load in the controller, it works just perfectly (without validation errors of course).

I've used $this->load->database(), loaded in both the model and controller, and my configuration in the database config file is correct. I never usually ask for help but this problem has definitely stumped me.

Can someone please assist me? I would be absolutely appreciative.
Thank you, Sakamoto.


Messages In This Thread
Problem loading up model - by El Forum - 07-09-2011, 01:57 AM
Problem loading up model - by El Forum - 07-09-2011, 02:20 AM
Problem loading up model - by El Forum - 07-09-2011, 04:45 PM
Problem loading up model - by El Forum - 07-10-2011, 04:30 PM
Problem loading up model - by El Forum - 07-10-2011, 11:09 PM
Problem loading up model - by El Forum - 07-12-2011, 08:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB