CodeIgniter Forums

Full Version: Fatal error when loading model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, all!  I'm fairly new to CodeIgniter and this forum.  I came to this forum to ask for help.  You see, whenever I load a page that requires database activity, I immediately get this error: 
Code:
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 24 bytes) in C:\xampp\htdocs\Isko\application\third_party\MX\Modules.php on line 194

I tried debugging by increasing the memory limit (which is a bad practice).  I also, tried removing this line of code in every controller  and model I have
PHP Code:
$this->load->model('model_name); 


Now, whenever I remove that, the web page displays fine with a few errors here and there, but the web page loads.  When I put it back, the error comes back.

Here's what I have and I'm using the HMVC architecture by the way.
CONTROLLER: profile_s_a.php

PHP Code:
<?php
    if 
(!defined('BASEPATH')) exit('No direct script access allowed');

 
   class Profile_s_a extends CI_Controller 
    
{
 
       function __construct()
 
       {
 
           parent::__construct();
 
           $this->load->helper('url');
 
           $this->load->model('s_p_a_profile_model');
 
       }
 
       
        public 
function index($a ''
 
       
 
           $data['condition']=array('scholar_id'=>$a);
 
           $result $this->s_p_a_profile_model->call_profile($data); 
 
           $data = array('bio'=>$result);
 
           $this->load->view('scholar-profile_a/scho_profile_a_header'$data);
 
           $this->load->view('scholar-profile_a/scho_profile_a'$data);
 
       }
 
   }
?>

MODEL: S_p_a_profile_model.php


PHP Code:
<?php
    if
(!defined('BASEPATH')) exit('No direct script access allowed');
 
   class S_p_a_profile_model extends CI_Model
    
{
 
       function __construct() 
 
       {
 
           parent::__construct(); 
 
           $this->load->model('s_p_a_profile_model');         
        
}
 
       
        function call_profile
($param)
 
       {
 
           $query $this->db->get_where('tblscholar'$param['condition']);
 
           return $query->row_array();
 
       }

 
   }
?>


Can anyone help me solve this?  I'm using CodeIgniter 3.1.6 with HMVC plugin.
Your model recursively loads itself infinitely, and this is easily spottable with just a glance.