Best way to store stats of multiple people weekly [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 5 years ago.
Improve this question
I am using the Clash Of Clans api to show all the members of the clan on a web page. But now I want to save all the donations, cups and received donations on a weekly base. So i can see in a very clear overview who are the most active members. But the thing is. I just don't know how to design the database. I was thinking to create a table every week that would look like this: StatsWeek[number]: (MemberTag, Donations, DonationsReceived, Cups). But then at some point i will have a large amount of tables. So I tought there has to be a more efficient way. But I can't think of a better way.. I am using a MySql Database

Like mentioned in the comments, it's better to store everything in a single table... you can save weekly transactions(or daily, whatever interval you choose). Here is an example schema for you.
To find, for example, troops donated on any given week; you will have to subtract the previous weeks donations from that weeks donations.

Related

Is setting picture names to dates of their creation in the database the best way to name pictures so that they'll be unique? [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 11 days ago.
Improve this question
My goal is to add pictures inserted by user into a database. So I'm trying to set their names to the date of their creation. The format is "day.month.year hour.minute.second". But I'm facing the problem that the only one picture is added to the catalog. I'm thinking that the reason why it happens is because the script runs too fast for a second to pass.
And that made me think if this is a good idea to name pictures this way.
I started to assume that maybe I need to use some kind of library to manually add a second to every next picture's name.
But before doing that I decided to go ask somebody more profecient than me in order to undesrtand whether I need to do it this way or maybe there's a better one

Laravel Best Practice for save user activity log in database ( with considering database Performance) [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 1 year ago.
Improve this question
I have a website (Laravel + Mysql on top of 'dedicated server') where I save all the pages that every user sees for reporting.
My site is visited 10,000 times a day and this statistic makes the database size bigger after a few months. now 'visits' table occupied 85% of whole database!
Is there a way to do this that is the best way possible?
I have not encountered this problem before, but I think its better to take the logging with this much of heavy load out of primary database, you can move it to a file system or logging services (read this).
Or you can have job (background process) to remove the logs that you don't need Like logs from a month ago, this will help db a little bit.
Read some best practices

Best way to save user entries from a puzzle to database [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 2 years ago.
Improve this question
I have an online exam portal build in codeigniter framework with mysql database. Exam is like sudoku game each student will get 6 sudoku game in exam. At a time there will be 50 - 100 students attending the exam and each one will get different puzzles.
I developed in such a way that when student start the exam it will fetch this 6 row from database and display the UI for puzzles, each time when they enter a number in any box it will save into database.So if 100 students attending the exam that many calls will get fired into database.
So what i am facing now is when number of students is like 20 - 30 exams was smooth and if user increases i am getting connection error like "Too many connection to user" or "failed to connect to mysql database".
So what i am asking you is there any better way to store this user entries and save them at once into database like using any session( if its not increase memory usage ) or client side storage.
Please don't feel bad to read this long text, i am not asking any codes just give me some ideas or latest technologies i can learn and use to improve my application.
I think increasing/upgrading bandwidth will help you in that case...also you can check monthly visits provided by your hosting provider in your current plan.

Resetting Plan-Based Subscription In 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 3 years ago.
Improve this question
I am trying to develop a system where a user can buy a premium subscription for a certain amount of time (maybe a month or a week) however upon expiration of this subscription, I want to reset the user back to basic plan on Laravel.
I have been researching this, and I was able to find a way that has to do with setting up cron jobs based on the plan subscription length.
Is this the best way possible? And if yes, is there a way I can set up crons in Laravel controllers (i.e after the user's payment is confirmed).
The way I would go about this is to have a date the subscription ends for that user within the database. You can then alter your business logic, ui etc so that they get the correct experience depending on whether this date has passed or not yet.

SQL table - Data management [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am creating a website where users can easily calculate the calories they eat and see the repartition in term of fat, carbo, etc.
I want the users to be able to retrieve data from previous days.
I then need to store the data sent by my users everyday (basically, they input how much of each food they have eaten everyday and I am making the calculation then store the results).
The question if the following: what would be the best way to store the data? I have to store the data for each user for each day. I can't think of a simple solution (I think creating a new table for each new day would not be great, would it?).
I'm using PHP and MySQL for now.
Thanks for the help!
It seems that you are a step ahead of your self with the daily breakdown question.
First, you need to decide what you need to store, e.g. fields and normalise the way they are stored.
For example, you would have the following tables:
Users:
Id
..
EatItems:
UserId
ProductId
Calories
Fat
DateTime
Once you have these tables up and running, you can build reporting layer on top of that to breakdown consumption by user / date or anything else you might be interested in.
You could have a table that holds the input/calculated data/date which relates to a user/account.
When the user views previous day's, select the data that relates to that user.
I wouldn't create a table for each day. One table would suffice.
However, I would suggest attempting something and posting the code for specific issues you have if you run into before posting here.

Categories