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

  • Home
  • SEARCH
  • 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 6218769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:40:00+00:00 2026-05-24T07:40:00+00:00

Ok so this question is not so much about the coding procedure, but more

  • 0

Ok so this question is not so much about the coding procedure, but more like a good and clean way to code this activitylist, i plan to build..

This activitylist will contain all activities on the page.

So basically on all the actions made on the page, it will call something like a function insertActivity($stuff) to insert the activity about that e.g you just did something.

Now I am wondering the coding way, how should I do it?

Should I have the message “you just did something” in the row in db or should i have numbers where in my php file i define that number 1 stands for “you just did something”?

With message not stored in db will help me editing the message for all the activitymessages later, e.g if the message should be changed to “you just ate something”.

Should i do it like i said previously about calling a function before/after the action saves, to log this action into the activitylist, or any other prefferable way to do it?

What i had in mind was just that insertActivity() should just insert the activity to the database, by the inputs ($stuff) it got.

Really appreciate a simple and clean coding way to do this.

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

    That is… an impossible question. It isn’t impossible in the fact that it is difficult to answer, it isn’t impossible in that it is impossible to give a good answer, it is impossible because there are many, many different good answers and no “right” answers.

    There is a lot to be said about having two tables, one is just for descriptions, the other is has a foreign key which will reference a description ID. Retrieving the value is as simple as:

    SELECT -- your other columns can go here.
           (SELECT DESCRIPTION FROM DESCRIPTIONS DE 
                WHERE DE.ID = DID.DESCRIPTION_ID LIMIT 1) as ACTIVITY
                -- I always add a LIMIT in a sub-query...
           -- your other columns can go here.
           FROM DID_THINGS DID WHERE USER_ID = 1;
    

    MySQL makes this type of structure a little bit easier if there are a reasonably finite number of activities (and those are known beforehand) — you should look into the ENUM type. With ENUM’s, however, that becomes the most annoying way of modifying the site. Personally, I like the second table option and I use it very frequently. If I want to have it so that an admin can add something like “You watched something,” I can simply expose that via a web form and keep the precious keys to the database hidden away where no-one knows them, including me.

    Another frequent way of doing things is to simply have an associative array (or a hash, or whatever). The benefit of this is that it may not involve a database connection, it is very simple and it is very easy and obvious to test and debug. Because of these (among others), it is very common to find this used in the internationalization scripts. The problem is that in order to add something to one of those arrays, you will need to actually go, modify the file, and then re-deploy the file to all versions of the site. Now, often this is something trivially simple, but it is an extra step. It is very difficult (though not strictly impossible) to allow a user to add to the list, and it is even more annoying to edit the data once entered.

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

Sidebar

Related Questions

For starters, this question is not so much about programming in the NetBeans IDE
Not much to say about this question...
This question is not so much about finding a solution as about getting an
This question is not so much programming related as it is deployment related. I
The current top-voted to this question states: Another one that's not so much a
I'm sorry for this very newbish question, I'm not much given into web development.
This question might not seem programming related at first, but let me explain. I'm
This question is NOT about race-conditions, atomicity, or why you should use locks in
This question is not about which is the best, it is about which makes
This question is not about 'best' barcode library recommendation, we use various products on

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.