CodeIgniter Forums
model will not work! [solved] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: model will not work! [solved] (/showthread.php?tid=2305)



model will not work! [solved] - El Forum - 07-28-2007

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



model will not work! [solved] - El Forum - 07-28-2007

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



model will not work! [solved] - El Forum - 07-28-2007

[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


model will not work! [solved] - El Forum - 07-28-2007

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