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 6579143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:51:42+00:00 2026-05-25T15:51:42+00:00

I have a variety of functions within my models which serve a different purpose.

  • 0

I have a variety of functions within my models which serve a different purpose.

One for example looks up the data for a given $_GET variable in the URL string.

I am trying to work out a way of displaying an error message if there is no matching row in the database due to url string manipulation for example.

My first idea was simply to return an error message (if there is an error) with each call to the function, then simply have an if statement whereby if there is an error, an error view is shown, and if not the normal view is shown..

Problem with this is that this function is called numerous times in my controller, and other similar functions are called throughout my code which need similar error handling..

I dont want millions of similar if/else statements all over my code to handle errors..

Anyone got any better ideas?
Cheers

  • 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-25T15:51:42+00:00Added an answer on May 25, 2026 at 3:51 pm

    Use the flashdata item of the session class. You can concatenate error messages and put them in the flashdata item to display.

    my_function(){
        // code that determines if there is an error returns => $error
        if ($error)
        {
            // concat previous and current errors
            $new_error = $this->session->flashdata('errors') . $error;
            // replace 'errors' with newly concatenated errors
            $this->session->set_flashdata('errors', $new_error);
        }
    }
    

    This will keep track of all errors generated through each request and allow you to display a “list” of errors for that particular request.

    echo $this->session->flashdata('errors');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have fit my discrete count data using a variety of functions for comparison.
I have tried a variety of different solutions found on stack and other places
I have a VS2005 solution which contains a variety of projects (C++ DLLs, C++
I have an interface for a variety of classes, all of which should implement
I have an application containing a variety of view controllers linked together in different
I have a php class Assets . Within Assets there are a variety of
I have a variety of PHP scripts that use the mysqli suite of functions
So we have a variety of search pages each with different search criteria, so
I have a variety of anchor tags and input buttons that trigger a variety
I have a program that works with a variety of files on both the

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.