Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6114251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:57:11+00:00 2026-05-23T14:57:11+00:00

I have a section of my code that is causing my whole page to

  • 0

I have a section of my code that is causing my whole page to load white with no error message.

I have debuged my code and the following section is causing my issue but I cannot work out why:

Problem Code:

        if($this->image_model->updatePage($id, $caption)) {
                        $data['title'] = 'Image Captions';
                        $data['cms_pages'] = $this->navigation_model->getCMSPages();
                        $data['sales_pages'] = $this->sales_model->getSalesPages();
                        $data['get_images'] = $this->image_model->getImages();
                        $data['content'] = $this->load->view('admin/imagecaption', $data, TRUE); #Loads the "content"
                        $this->load->view('admintemplate', $data); #Loads the given template and passes the $data['content'] into it    

                        }//END if updatePage

Full Controller Document:

function index(){

    if(!$this->session->userdata('logged_in'))redirect('admin/home');

        $data['title'] = 'Image Captions';
        $data['cms_pages'] = $this->navigation_model->getCMSPages();
        $data['sales_pages'] = $this->sales_model->getSalesPages();
        $data['get_images'] = $this->image_model->getImages();
        $data['content'] = $this->load->view('admin/imagecaption', $data, TRUE); #Loads the "content"
        $this->load->view('admintemplate', $data); #Loads the given template and passes the $data['content'] into it

    if ($this->input->post('submit')){

                #The User has submitted updates, lets begin!

                #Set The validation Rules   
                $this->form_validation->set_rules('captionInput', 'Caption', 'trim|required|xss_clean');

                    if ($this->form_validation->run() == FALSE){ #Form Validation Fails Load The Default Page

                    $data['title'] = 'Image Captions';
                    $data['cms_pages'] = $this->navigation_model->getCMSPages();
                    $data['sales_pages'] = $this->sales_model->getSalesPages();
                    $data['get_images'] = $this->image_model->getImages();
                    $data['content'] = $this->load->view('admin/imagecaption', $data, TRUE); #Loads the "content"
                    $this->load->view('admintemplate', $data); #Loads the given template and passes the $data['content'] into it

                }// END Form Validation 

                #Form Validation passed, so lets continue updating.
                #lets set some variables to pass into the database for editing.

                    $caption = $this->input->post('captionInput', TRUE);
                    $this->db->escape($caption); # Lets check for security and mel objects :)

                #Now if imageCaption fails to update the database then show "there was a problem".

                    if($this->image_model->updatePage($id, $caption)) {
                        $data['title'] = 'Image Captions';
                        $data['cms_pages'] = $this->navigation_model->getCMSPages();
                        $data['sales_pages'] = $this->sales_model->getSalesPages();
                        $data['get_images'] = $this->image_model->getImages();
                        $data['content'] = $this->load->view('admin/imagecaption', $data, TRUE); #Loads the "content"
                        $this->load->view('admintemplate', $data); #Loads the given template and passes the $data['content'] into it    

                        }//END if updatePage
                    }else{
                        $data['title'] = 'Image Captions';
                        $data['cms_pages'] = $this->navigation_model->getCMSPages();
                        $data['sales_pages'] = $this->sales_model->getSalesPages();
                        $data['get_images'] = $this->image_model->getImages();
                        $data['content'] = $this->load->view('admin/imagecaption', $data, TRUE); #Loads the "content"
                        $this->load->view('admintemplate', $data); #Loads the given template and passes the $data['content'] into it

    } //END Submit 

} //END function index()

}

Image Model:

class Image_model extends CI_Model
{

function __construct() {
        parent::__construct();
}

function getImages($path = NULL) {
foreach($this->db->get('images')->result_array() as $r) {

    $rows[] = $r;
}

return $rows;
}

function addImage($imgdata) {
    $this->db->insert('images',$imgdata);
    return;
}

function deleteimage($id){

    $this->db->where('id', $id);
    $q = $this->db->get('images');
    $row = $q->row_array();

    if ($q->num_rows() > 0){
        //delete from the database
        $this->db->where('id', $id); 
        $this->db->delete('images');

        //lets delete the image
        unlink("includes/uploads/gallery/".$row['imagename']);
        //lets delete the thumb.
        unlink("includes/uploads/gallery/thumbs/".$row['thumbname']);
    }//END if num_rows
}//END function deleteImage($id)

function updateCaption($id = NULL, $caption = NULL){
    #set the $data passed to the function into an array, content being the column name.
    $data = array('description' => $caption);

    $this ->db->where('id',$id);
    $this->db->update('images', $data);

    return TRUE;
}

}//END class Image_model
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:57:12+00:00Added an answer on May 23, 2026 at 2:57 pm

    In your controller is $this->image_model an instance of your Image_Model class? If so, in the model you posted, there does not appear to be an updatePage() method .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following section of code in an app that I am writing:
I have a section of code that is being used to determine if a
I have a section of code that can be summarised as follows; void MyFunc()
I have following Code Block Which I tried to optimize in the Optimized section
I have a section of code that I would not like to run if
I have a section of code that I need to remove from multiple files
I have a section of code that sends email from SMTP server. The code
Interesting situation. I have a section of code that creates several ZipOutputStreams. As a
I have a section of code that depending on the URL requested, will include
I have a section of code that sometimes needs to call cancelPreviousPerformRequest and other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.