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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:32:16+00:00 2026-05-26T22:32:16+00:00

I am making a site which allows users to sign up and record their

  • 0

I am making a site which allows users to sign up and record their daily activities in a table. Their activities will be stored in a MySQL database, and will be displayed using jQuery/PHP.

Here is an example picture of the type of data being storedenter image description here

The problem is, I have no idea how to properly store this type of information.

I was originally going to create a table for each user called $userid . "_activies" or something along those lines, with the columns id, user_id, type, location, duration, date. Then to read the data, I would simply check for what date they want and load all of the activities that match that date. This works fine, but I can’t figure out how to update existing entries properly.

For example: In the picture above, if you wanted to change the duration of the “Kitchen” row, how would you go about detecting if it already exists in the database? You can’t simply check for a row containing ‘cleaning’ and ‘kitchen’ on 11/18/2012 then overwrite it, because Kitchen could appear multiple times in the cleaning section (say they cleaned the Kitchen a second time after going to the Bathroom).

I originally thought about making each <tr> have an id equal to the id field for the data that it loaded, then when it comes time to save the data, check if the row id already exists and overwrite it. This seems like a poor workaround for my issue.

I’d like to be able to just completely clear the original data for the entire day and rewrite it with whatever the table contains when they hit save. Would it be reasonable to just delete every row in the table that matches the date of the table, then write new information? Or is there a better way to store this information. For example, should I create a new table for each day for each user? That seems like a lot of tables…

I’m stumped, can anyone share any ideas on ways to set up the database?

  • 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-26T22:32:17+00:00Added an answer on May 26, 2026 at 10:32 pm

    I am a big believer in keeping your data in logical chunks. Never be afraid of using more tables if it means keeping everything logical. Based just on what you said I would have at least the following tables:

    User ( user_id, user_name, password, email, …)
    Location( location_id, location_Name, …)
    Durations ( duration_id, duration_length(increment in 5, 10 or 15 minutes chunks from what would be the smallest duration to what would be the largest))
    Activity( activity_id, activity_name, activity_description, activity_user(user_id), activity_date, activity_location(location_id), activity_duration(duration_id)…)

    Again, that is based on the elements described in your question. This way, everything would be stored in Activity, and you would obviously want to index activity_user. You would simply add activities into Activity as they are entered, and display them based on activity_user and activity_date. Hope this helps.

    ETA: I realized that I didn’t answer your final questions. As I said, you would enter fresh activities into Activity, and, if you wanted a situation where you only maintain the most current records for a given user you simply delete all activities for user_id where activity_date is not the most recent date. It’s tough to give sample code because I’m not sure what you mean exactly. I hope that I at least conveyed the basics properly.

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

Sidebar

Related Questions

I'm building a site which allows users to log on to it, and uses
I'm making some site which must be fully unicode. Database etc are working, i
I am designing a typical ASP.NET site which will connect to database to retrieve
I'm making a site that will be translated into x languages. All strings must
I'm making a site to document browser bugs where users can submit a bug
I'm making a site in which I'm using jQuery to change background images on
I am currently making a site which uses OpenLayers and plotting with the BBOX
I'm making a site which has a list of videos. Next to each video
I am making a site that publishes articles in issues each month. It is
I am making a site right now and I want to include the sidebar

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.