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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:36:26+00:00 2026-05-27T13:36:26+00:00

I have an application where it seems as if it would make sense to

  • 0

I have an application where it seems as if it would make sense to store some records hard-coded in the application code rather than an entry in the database, and be able to merge the two for a common result set when viewing the records. Are there any pitfalls to this approach?

Firstly, it would seem to make it easier to enforce that a record is never edited/deleted, other than when the application developer wants to. Second, in some scenarios such as installing a 3rd party module, the records could be read from their configuration rather than performing an insert in the db (with the related maintenance issues).

Some common examples:

                                       In the application        In the database
-----------------------------------    ------------------        ----------------------
customers                              (none)                    all customers
HTML templates                         default templates         user-defined templates
'control panel' interface languages    default language          additional languages
Online shop payment processors         all payment processors    (none)

So, I think I have three options depending on the scenario:

  1. All records in the database
  2. Some records in the application, some records in the database
  3. All records in the application

And it seems that there are two ways to implement it:

  1. All records in the database:
    • A column could be flagged as ‘editable’ or ‘locked’
    • Negative IDs could represent locked values and positive IDs could represent editable
    • Odd IDs represent locked and even IDs represent editable…
  2. Some records live in the application (as variables, arrays or objects…)

Are there any standard ways to deal with this scenario? Am I missing some really obvious solutions?

I’m using MySQL and php, if that changes your answer!

  • 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-27T13:36:26+00:00Added an answer on May 27, 2026 at 1:36 pm

    In general, anytime you’re performing a database query if you want to include something that’s hard-coded into the work-flow, there isn’t any joining that needs to happen. You would simply the action on your hard-coded data as well as the data you pulled from the database. This is especially true if we’re talking about information that is formed into an object once it is in the application. For instance, I can see this being useful if you want there to always be a dev user in the application. You could have this user hard-coded in the application and whenever you would query the database, such as when you’re logging in a user, you would check your hard-coded user’s values before querying the database.

    For instance:

    // You would place this on the login page
    $DevUser = new User(info);
    $_SESSION['DevUser'] = $DevUser;
    
    // This would go in the user authentication logic
    if($_SESSION['DevUser']->GetValue(Username) == $GivenUName && $_SESSION['DevUser']->GetValue(PassHash) == $GivenPassHash)
    {
        // log in user
    }
    else
    {
        // query for user that matches given username and password hash
    }
    

    This shows how there doesn’t need to be any special or tricky database stuff going on. Hard-coding variables to include in your database driven workflow is extremely simple when you don’t over think it.

    There could be a case where you might have a lot of hard-coded variables/objects and/or you might want to execute a large block of logic on both sets of information. In this case it could be beneficial to have an array that holds the hard-coded information and then you could just add the queried information to that array before you perform any logic on it.

    In the case of payment processors, I would assume that you’re referring to online payments using different services such as PayPal, or a credit card, or something else. This would make the most sense as a Payment class that has a separate function for each payment method. That way you can call whichever method the client chooses. I can’t think of any other way you would want to handle this. If you’re maybe talking about the payment options available to your customers, that would be something hard-coded on your payment page.

    Hopefully this helps. Remember, don’t make it more complicated than it needs to be.

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

Sidebar

Related Questions

I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be
I have an application that seems to throw exceptions only after the program has
My RMI enabled application seems to be leaking sockets. I have a Java application
I have inherited a poorly written web application that seems to have errors when
It seems like when you have a WinForms .NET application, and a ComboBox (set
Hugs seems to have a problem with several non-enbraced !! in a partial application.
I have just inherited a server application, however it seems that the only copy
We have an XMPP application that uses MySQL to store information. We are not
I followed an tutorial how to make application support plugins. Everything seems to be
I'm currently working out the layout of a WPF Application and seem to have

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.