Welcome Guest, Not a member yet? Register   Sign In
Wierd Error
#1

[eluser]bigg-media[/eluser]
I created this site on my local computer using WAMP with PHP 5. I moved it to my hosting server which is PHP4. I have numerous other CI sites hosted on this server with no issues whatsoever. In fact a large part of this site (other than the models) is a copy of a functioning site. In my main controller I am having issues. I have the database autoload, then in the controller I am calling the models. In my first function I can access the model methods just fine, but every other function throws an error anytime I reference a model method.

Controller - Content
Code:
<?
class Content extends Controller {

    function Content()
    {    
        parent::Controller();
        $this->load->model('account');
        $this->load->model('project');
        $this->load->model('contact');
        $this->load->model('paragraph');
        $this->load->model('production');
        $this->load->model('calendar');
        #$this->userid = $this->session->userdata('ContactId');
        $this->userid = '61463116-58AA-DC11-AF0F-0019B9CCA70F';
    }
        
    function index()
    {
        #$this->auth->check();
        $data['page'] = 'overview';
        $data['page_title'] = 'Account Overview';
        $data['customerid'] = $this->contact->GetCustomerId($this->userid);
        $data['customer'] = $this->account->Location($data['customerid']);
        $data['projects'] = $this->project->GetProjects($this->userid);
        #print $this->userid;
        $this->load->vars($data);
        $this->load->view($this->config->item('default_template_dir').'template/container');
    }        

    function library()
    {
        #$this->auth->check();
        $data['page'] = 'library';
        $data['page_title'] = 'View Library';
        $data['customerid'] = $this->contact->GetCustomerId($this->userid);
        $customerid = $this->contact->GetCustomerId($this->userid);
        $data['parentlocation'] = $this->account->Location($customerid);
        $data['projects'] = $this->project->GetProjects($this->userid);
        if($this->uri->segment(3)){
        $data['paragraphs'] = $this->paragraph->GetParagraphs($this->uri->segment(3));
        $data['currentlocation'] = $this->account->Location($this->uri->segment(3));
        } else {
        $data['paragraphs'] = $this->paragraph->GetParagraphs($data['customerid']);
        $data['currentlocation'] = $this->account->Location($data['customerid']);
        }
        $this->load->vars($data);
        $this->load->view($this->config->item('default_template_dir').'template/container');
    }

My Account Model
Code:
<?
Class Account extends Model {

function Account()
{
    parent::Model();
}

function Location($id)
{
    $CI =& get_instance();
    $this->db->where('AccountId',$id);
    $query = $this->db->get('CRM_Account');
    return $query->row();
}

function BranchName($id)
{
    $CI =& get_instance();
    $this->db->where('AccountId',$id);
    $query = $this->db->get('CRM_Account');
    $name = $query->row();
    return $name->Name;
}


}

?>

If I don't comment out the second function I get this error:
Call to a member function on a non-object in /home/bmeaudio/public_html/portal/system/application/controllers/content.php on line 35

I have been chasing this problem all day and don't think I am any closer to a resolution than I was this morning. Really need some help on this one.
#2

[eluser]Rick Jolly[/eluser]
Library is a reserved name, so it can't be used as a method name.
http://ellislab.com/codeigniter/user-gui...names.html
#3

[eluser]bigg-media[/eluser]
[quote author="Rick Jolly" date="1212628328"]Library is a reserved name, so it can't be used as a method name.
http://ellislab.com/codeigniter/user-gui...names.html[/quote]

You are a genius. I knew it was something simple, but have had my head down too long to think clearly.

I appreciate the help.




Theme © iAndrew 2016 - Forum software by © MyBB