ok, i'm making a little online game, just for fun, and in it you can 'attack' people. what i want to do is make it so u can only attack a particular person once a day.
how would i do this??? cookies wouldnt work as the user could just delete them, and neither sessions cuz the suer could just close the browser. all i can think of is an absolutely massive MySQL database, sure theres a better way?
the quickest, most resourceful, easy way to do this?
Moderator: General Moderators
- Sevengraff
- Forum Contributor
- Posts: 232
- Joined: Thu Apr 25, 2002 9:34 pm
- Location: California USA
- Contact:
-
ilovetoast
- Forum Contributor
- Posts: 142
- Joined: Thu Jan 15, 2004 7:34 pm
Four db fields:
id - primary key
attacker_id - the one attacking, foreign key for a separate user table
defender_id - the one being attacked, foreign key for a separate user table
attack_time - time of attack as timestamp of your choice
One table row per possible attack. The row only needs to exist if the attack actually occured and you can use a housekeeping routine to periodically discard badly out of date entries.
Then, as Sevengraff pointed out, just run two queries.
peace
eat toast all day long
id - primary key
attacker_id - the one attacking, foreign key for a separate user table
defender_id - the one being attacked, foreign key for a separate user table
attack_time - time of attack as timestamp of your choice
One table row per possible attack. The row only needs to exist if the attack actually occured and you can use a housekeeping routine to periodically discard badly out of date entries.
Then, as Sevengraff pointed out, just run two queries.
peace
eat toast all day long
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA