Forum Moderators: open
This is a sample of how the data is stored in the sql log file...
INSERT INTO `logs` VALUES (1, 2, 1, 1, 2, 'aaaaaaa', 1, 2000, 200, '08-11-2008 - 12:23:43', 1226172223);
INSERT INTO `logs` VALUES (2, 1, 2, 2, 1, 'admin', 1, -2000, 0, '08-11-2008 - 12:23:43', 1226172223);
INSERT INTO `logs` VALUES (3, 2, 1, 1, 2, 'aaaaaaa', 10, 19000, 1253, '08-11-2008 - 12:24:01', 1226172241);
INSERT INTO `logs` VALUES (4, 1, 2, 2, 1, 'admin', 10, -19000, 0, '08-11-2008 - 12:24:01', 1226172241);
As you can see the last two values are the timestamp of when the actions occured and the 6th value is the players name. The game doesn't reset, it continues on and allows players to build up profiles, so I have no specific monthly "totals" to draw from. How would I query this database to get the following...
- Final List of top 10 Players based on the highest "6th value" during the month of "month name".
- Running List of current top 10 players based on "6th value".
I would then need to create another table to store this information so that the "monthly winners" page doesn't need to query the entire rather sizable database continuously.
I've got this so far, it's highly unfinished.
$result = $db->query("SELECT * FROM logs WHERE GoStat=!");
The ! would be replaced with what to filter out a specific time period? (goStat is the timestamp table).
How would I get a running total limited to the past 30 days from this?
Hope thats not too confusing. It seems simple enough...
- Final List of top 10 Players based on the highest "6th value" during the month of "month name".
- Running List of current top 10 players based on "6th value".
As far as limiting the search, you'll need to use:
WHERE GoStat BETWEEN SomeStartDate AND SomeEndDate