[help] Game counter?

Im not sure how to go about this script.

Basically I have games on my website and users are only allowed to play a specific game 5 times a day. And the next day the counter will start at 0 again.

I created a database table with fields like “users”, “game_title”, “times_played” and “date”.

But I’m not sure how to create a script that will determine if the user has played the allocated amount times or if they can still play that day and how do I get the counter to start at 0 again every day?

I would really appreciate any help or advice.