Welcome Guest, Not a member yet? Register   Sign In
model will not work! [solved]
#1

[eluser]Unknown[/eluser]
update: my editor inserted quotes were bad...

I cannot get my model to load and it is driving me crazy!

Controller (register.php):
Code:
<?php

class Register extends Controller {

    function __construct()
    {
        parent::Controller();
        $this->load->model(‘Rmodel’);
    }
    
    function index()
    {
        redirect('/etc/');
    }
}
?>

Model (rmodel.php):
Code:
<?php

class Rmodel extends Model {

    function __construct()
    {
        parent::Model();
    }
    
    function doSomething()
    {
        return $this->db->get('etc');
    }
}
?>

error:
Code:
An Error Was Encountered

Unable to locate the model you have specified: �rmodel�
#2

[eluser]Rick Jolly[/eluser]
As opposed to this:
Code:
$this->load->model(‘Rmodel’);
Try this:
Code:
$this->load->model('Rmodel');
#3

[eluser]alexsancho[/eluser]
Try this in your model

Code:
<?php

class Rmodel extends Model {

    function Rmodel()
    {
        parent::Model();
    }
    
    function doSomething()
    {
        return $this->db->get('etc');
    }
}
?>

and call it from your controller without capitals, hope this helps
#4

[eluser]Unknown[/eluser]
YOU SAVED ME!!

I switched to using TextWrangler today, and it was inserting these quotes instead.. didn't even pick that up.. anyway, good reason to go back to Smultron.

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB