Keeping CMS history or not? [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a database / systems question.
Say you have a CMS system done in PHP and Mysql
When you have users who edit their details, do you just update their row with the changes or do you keep a history for example by updating their row by setting the column 'status' = H (For History) and insert new row with all the old & new changed details with column 'status' = A (For Active) and that becomes the primary row?
I would just like to know what other developers do?

I'd keep a history for audit purposes but I'd move old records to a history table to prevent problems with primary ids. I wouldn't keep old records in the same table as current, that's just too much redundant data.

Related

store users in one table or multiple table Laravel [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 21 hours ago.
Improve this question
we are creating an e-learning website with Laravel, and we have multiple users (student, instructor, admin) should we store them in one table (users) or each user with own table.
I want to know if there is a convention
There is no set in stone rule, it is totally up to you. But from what I see in most Laravel projects, and what I do in my projects as well, to make it easier to read/troubleshoot you use a single "users" table and make a "profile" or "profile_type" column to determine which one are they attached to.

Create a table with logs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
My quick question is that I have a table that records users relations: userRelations(id, userID_1, userID_2, relationshipType, dateCreated). Now how do I create a log to see what was changed? Or by whom? Most of it is done php and then inserted into the table, but which columns must I have ?
EDIT: My difficulty was to understand the process of making a log, how to record, what to record, how many tables and such, I couldn't think clear enough to organize and say "This is what I need"
Create a new table that is updated each time this table is updated with the following headings
id,
userRelationsid (or shorten this if possible),
updatedby,
updatedrelationshipfrom (or shorten this if possible),
updatedrelationshipto (or shorten this if possible),
dateupdated,

PHP: Preventing users from getting the same incremented ID [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm building a php web app that requires to create an invoice, where its ID must be incremented (e.g: 15235, 15236, 15237,...etc). It all works fine with 1 user creating the invoice. The the issue arise when there are more than 1 users hitting the create button at the same time. Supposedly the next incremented ID is 15230, and having 3 users hitting the create button the same time, the app will return 15232 to all 3 users.
FYI, I store the last used ID in a database and increment it when users create an invoice.
Does anyone has any solution? Your suggestion is much appreciated.
Simply use built-in mechanics and define ID field as AUTO_INCREMENT.
You can read more about that here.
After that just skip ID in your INSERT queries and database will take care about that for you.

What is the best way to store pageviews in MySQL? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a MySQL table "news" where I store "id","title","description". I would like to store pageviews and later use it to rank pages according to popularity.
What is the best way to do it? I've heard a lot of people complain about MySQL freezing due to high traffic. I don't want that to happen.
A simple counter would work, something like: update news set page_views=page_views+1 where id=xxxx
MySQL drives a lot of very large sites....

Database design for handling quiz site stats [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I need to create a quiz site and I'm not sure about how should I proceed with statistics. The site needs to track each users progress (which answer was answered how, how many time does it take to answer each question etc).
Should I create a new table (let's say 'statistics), and should I create a new row each time a user has finished a quiz? So, statistics:
user_id
quiz_id
answers (in serialized form, because the amount of questions is variable)
time_of_answer (same as above)
points_for_each_answer (same as above)
Wouldn't this be too slow, if the admin wants to check some stats, let's say: how many users have correctly answered the question #2 under the 3rd quiz?
Don't serialize answers if you need them as a real entity - just give them a quiz_id foreign key so you know to which quiz they belong, use proper indexes, and everything will run smooth.

Categories