• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fatal error in system's core file: Allowed memory exhausted (tried to allocate …) in C:…systemcoreOutput.php on line 164

#1
[eluser]Unknown[/eluser]
Hi,
I've got this error that makes my script take longer than usual to execute. I've tried to go through similar posts but the advice I'm getting out of them is to allocate more or unlimited memory size of which others claim might cause problems in future. I tried checking my XAMPP control panel and noticed there was an error "Not logged in as an administrator" so I fixed that but still the memory error won't be fixed, I tried going through my code but everything seemed to be fine since the system is supposed to use a single form for both inserting and updating data into the database and of course it does so but takes longer than usual to execute. I've I messed up my code or is there a way out of this instead of cheating with allocating more or unlimited memory? Any help would be highly appreciated, thanks in advance. Find below my code snippets.

controller - vetting.php

Code:
public function create_institution_contact_info()
{
    $data['main_content'] = 'institution_contact_info_view';
    $data['method'] = 'create_institution_contact_info';
    $this->load->model('institution_users_model');
    $data['form_data'] = $this->institution_users_model->get_institution_contact_info();
    $data['title'] = 'Institution Contact Information';
    $this->load->view('includes/template', $data);

    $this->form_validation->set_rules(
        'institution_registration_no',
        'Institution Registration Number',
        'trim|required|is_unique[institution_contact_info.institution_registration_no]'
    );
    $this->form_validation->set_rules('institution_address', 'Institution Address', 'trim|required');
    $this->form_validation->set_rules('institution_telephone_no', 'Institution Telephone Number', 'trim|required');

    if($this->form_validation->run()){
        //$this->load->model('institution_users_model');
        $create_institution_contact = $this->institution_users_model->create_institution_contact();

        if($create_institution_contact)
        {
            redirect('vetting/basic_info');
        }
        else
        {
            $this->create_institution_contact_info();
        }
    }
    else
    {
        $this->create_institution_contact_info();
    }
}

model - institution_users_model.php

Code:
public function get_institution_users_id()
{
    //Get each logged_in user's current session_id
    $email_address = $this->session->userdata('email_address');
    if($email_address){
        $this->db->where('institution_users.email_address', $email_address);
        $institution_users = $this->db->get('institution_users');  
        foreach($institution_users->result() as $row)
        {
            $institution_users_id = $row->institution_users_id;
        }
        return $institution_users_id;
    }      
}

public function create_institution_contact()
{                              
    $contact_data = array(
        'institution_users_id' => $this->get_institution_users_id(),
        'institution_registration_no' => $this->input->post('institution_registration_no'),
        'institution_address' => $this->input->post('institution_address'),
        'institution_telephone_no' => $this->input->post('institution_telephone_no'),
        'website' => $this->input->post('website')
    );

    $insert_contact = $this->db->insert('institution_contact_info', $contact_data);
    if($insert_contact)
    {
        return true;
    }
    else
    {
        return false;
    }
}

public function get_institution_contact_info()
{
    $this->db->where('institution_contact_info.institution_users_id', $this->get_institution_users_id());
    $institution_contact_info = $this->db->get('institution_contact_info');
    if($institution_contact_info->num_rows()>0)
    {
        $row = $institution_contact_info->row();
        return $row;
    }              
}

View - institution_contact_info.php

Code:
<div class="form">

            &lt;?php echo validation_errors(); ?&gt;
            &lt;form method="post" acti echo $method; ?&gt;"&gt;
                <label for="institution_registration_no">Institution Registration Number</label>
                &lt;input type="text" name="institution_registration_no" value="&lt;?php if(isset($form_data-&gt;institution_registration_no)){ echo $form_data-&gt;institution_registration_no; } ?&gt;" /&gt;
                <label for="institution_address">Address/Location</label>
                &lt;input type="text" name="institution_address" /&gt;
                <label for="institution_telephone_no">Institution Telephone Number</label>
                &lt;input type="text" name="institution_telephone_no" /&gt;
                <label for="website">Website</label>
                &lt;input type="text" name="website" /&gt;
                &lt;input type="submit" name="next_submit" value="NEXT" data-theme="a" data-corners="false" /&gt;                                                        
            &lt;/form&gt;
        </div>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.