Category:Windows software
Category:Windows componentsQ:
What kind of php/mysql logic should I use for this situation?
I want to implement a mysql table to store long-term index statistics (ie. the sum of $values over time) for a small number of users.
From a web page, I'd like to show the total number of users and the total total value.
What I want to do in php is have a series of methods and queries, but I'm not sure how to implement them correctly.
First, I have a table of records, each record containing a unique user_id and a timestamp.
Then, I want to:
show the number of records, based on a user_id
sum the values over time, based on a user_id
calculate the total value (sum over time of all the values)
count the number of values
calculate the average value (sum over time of all the values)
count the number of records per user
calculate the total sum for all users
I'd like to have some general-purpose code (ie. that doesn't just perform a single task) because I might need to modify it in the future.
I'm wondering how to calculate these values in PHP and MySQL.
Here's what I have so far: be359ba680
Related links:
Comentários