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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:01:39+00:00 2026-05-24T20:01:39+00:00

Often in my projects (PHP / MySQL) I have to add a status field

  • 0

Often in my projects (PHP / MySQL) I have to add a “status” field to some database tables. For example to mark if a task if submitted, approved, rejected.

Out of habit so far I’ve been using numerical status codes (0 for submitted, 1 for approved, -1 for rejected). For some reason in my mind I assume it is more efficient for the server to process.

Now I am wondering, is my assumption flawed? Does it matter? For readability, it would be easier to store those as VARCHAR such as ‘SUBMITTED’, ‘APPROVED’, ‘REJECTED’. Then in the PHP code instead of checking for the numeric value, check for the string.

I’m pretty sure that in theory checking for an INT is faster than a String. But is the different noticeable for a web app?

Please advise.

Thanks

  • 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-24T20:01:40+00:00Added an answer on May 24, 2026 at 8:01 pm

    Perhaps it’s just a matter of preference but I hate magic numbers with no evident meaning. In this case, there are normally two situations:

    • The values are unlikely to change (e.g., Sex: Male / Female)
    • The values are likely to change (e.g., Category: Local / National / Sports…)

    In the first case, I prefer to use ENUM as column type. It’s handled internally as integer but you refer to it as string.

    In the second case, I create a master table and define the child column as foreign key. That gives kind of meaning to the value, even if it’s an auto-incremented integer. And it doesn’t need to be an integer anyway.

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

Sidebar

Related Questions

when i read through source files of opensource projects i often come across some
I have been using MySQL for years, mainly on smaller projects until the last
In PHP, I often use the conditional operator to add an attribute to an
I've always seen these header comments in php, and often wondered if some software
How often do people use objects in PHP? I have noticed it has not
I often see something similar to this below in PHP scripts using MySQL query(SET
We have a custom-made system to track client tasks/projects. We manually add a checklist
I am working on a PHP project. There, I often use following syntax to
Looking back at my past projects I often encounter this one: A client or
When I read source from open source projects I often find a comment line

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.