[eluser]draconus[/eluser]
This has been an issue I have tried to overcome for three years now and I cannot seem to ever get the model to work. The error I am getting is as follows: Unable to locate the model you have specified: people_model
Here is what is in the model right now:
Code:
<?php
class People_model extends CI_Model {
var $type = '';
var $referred = '';
var $first_name = '';
var $last_name = '';
var $company = '';
var $phone ='';
var $alt_phone = '';
var $fax = '';
var $url = '';
var $email = '';
var $address = '';
var $address_2 = '';
var $city = '';
var $state = '';
var $postal_code = '';
var $country = '';
function _construct()
{
// Call the Model constructor
parent::_construct();
}
function get_last_ten_entries()
{
$query = $this->db->get('people', 10);
return $query->result();
}
function insert_entry()
{
$this->type = $_POST['type'];
$this->referred = $_POST['referred'];
$this->first_name = $_POST['first_name'];
$this->last_name = $_POST['last_name'];
$this->company = $_POST['company'];
$this->phone = $_POST['phone'];
$this->alt_phone = $_POST['alt_phone'];
$this->fax = $_POST['fax'];
$this->url = $_POST['url'];
$this->email = $_POST['email'];
$this->address = $_POST['address'];
$this->address_2 = $_POST['address_2'];
$this->city = $_POST['city'];
$this->state = $_POST['state'];
$this->postal_code = $_POST['postal_code'];
$this->country = $_POST['country'];
$this->db->insert('people', $this);
}
function update_entry()
{
$this->type = $_POST['type'];
$this->referred = $_POST['referred'];
$this->first_name = $_POST['first_name'];
$this->last_name = $_POST['last_name'];
$this->company = $_POST['company'];
$this->phone = $_POST['phone'];
$this->alt_phone = $_POST['alt_phone'];
$this->fax = $_POST['fax'];
$this->url = $_POST['url'];
$this->email = $_POST['email'];
$this->address = $_POST['address'];
$this->address_2 = $_POST['address_2'];
$this->city = $_POST['city'];
$this->state = $_POST['state'];
$this->postal_code = $_POST['postal_code'];
$this->country = $_POST['country'];
$this->db->update('people', $this, array('id' => $_POST['id']));
}
}
?>
And here is the controller:
Code:
<?php
class People extends CI_Controller {
public function index()
{
$this->load->model('People_model', '', TRUE);
$data['result'] = $this->People_model->get_last_ten_entries();
$this->load->view('people/index', $data);
}
public function edit()
{
$this->load->view('people/edit');
}
public function add()
{
$this->load->view('people/edit');
}
}
?>
I have no issues in regular old php, but I have wanted for so long to make codeigniter work because I know it is a strong and lightweight framework. I play for a week or so and get nothing to work, then find myself no ttouching it for a
year due to frustration. Please help!