Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [07:31:28] tiger45: Whats the best DB that you'd use for that
- [07:31:31] tiger45: I mean, the structure
- [07:31:56] Shane Mackenzie: sam probs
- [07:32:01] Shane Mackenzie: Ahh structure
- [07:32:35] tiger45: Making 1 table for each person, is a bitchy thing
- [07:32:36] tiger45: lol
- [07:33:26] Shane Mackenzie: How you want to display the info
- [07:33:36] tiger45: i want to make a site for it
- [07:33:39] tiger45: or just a page
- [07:33:41] tiger45: and on irc
- [07:33:42] tiger45: can be called
- [07:33:44] Shane Mackenzie: I mean, 24h max, or longer
- [07:34:15] tiger45: oh, want to keep them all
- [07:34:25] tiger45: so i can do something like !play 1w
- [07:34:29] Shane Mackenzie: The best way to do it would be like this:
- [07:34:30] tiger45: like my current mirc one
- [07:35:21] Shane Mackenzie: gLogs -> Growth Logs.
- Username / TFF / UnixTimeStamp
- Each update, You use insert into gLogs set....
- Set username/unixtimestamp as index
- [07:35:32] Shane Mackenzie: So, You update everyone, You get 6k new rows
- [07:35:38] Shane Mackenzie: You then do this:
- [07:37:51] Shane Mackenzie: $now = time();
- $old = time() - $hours * (60*60)
- Select * from gLogs where unixtime > $now -3600 --> Put this in array 1
- Select * from gLogs where unixtime > $old < $old+3600 (Should get 1 result for each player, mostly?
- [07:38:16] Shane Mackenzie: Then compare arrays
- [07:39:50] Shane Mackenzie: Makes sense?
- [07:40:11] Shane Mackenzie: The maths maybe wrong in the example, but thoery isnt
- [07:41:11] tiger45: brb
- [07:46:44] Shane Mackenzie: 5 hours growth
- $hour = 5;
- $now = time();
- $old = time() - ($hour * (60 * 60));
- $s = " select * from gLogs where unixtime > $now-3600 --> will return one row for each user in db....
- $ss = " select * from gLogs where unixtime > $old and unixtime < $old+3600 - -> should return 1 row for each user in db, thats 5 hours old, I think
- [07:46:52] Shane Mackenzie: then ermmm
- [07:47:52] Shane Mackenzie: $array['Shane'] = 1000
- $array2['Shane'] = 1337
- echo "Growth for: $user = ($array[$user] - $array2[$user])
- [07:48:06] Shane Mackenzie: Hope it makes sense, wrote in a shit way on Skype
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement