[HELP ]PHP/MySQL - Timed Interval Access
This is my first post here so HELLO. Forgive me if I'm going about this the wrong way and feel free to move my thread to the appropriate forum.
I'm trying to setup a voting system for web project I've been assigned, which is easy enough. The problem is, the end user can only vote once every 12 hours.
My initial thought concept would be to create a column called votepoints and a column named lastvotedate. When a user would vote, it would increase the integer value of votepoints by one and timestamp the lastvotedate.
The part I don't comprehend is how to convert the timestamp into an hourly format that could be used to validate the user's last vote date, then use IF statements to do verification based on username and timestamp.
If someone may offer assistance, or a better method using another technology, I'd greatly appreciate the help.
If you use a real datetime or timestamp column, you can use these in queries:
If you need to use PHP for comparison, you can use:
This will convert the string into a integer containing an amount of seconds.
If(time() - strtotime($row["datetime"]) > (60*60))
// If the current datetime is more than one hour ahead of the one in the database.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread