[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.