Hello all,
I've been working away on this, and finally I think I've found the solution I need to implement. However, I'm really cloudy on how I should do this, so any input would be much appreciated.
Basically, we have a monthly contest, and we want to allow users to be able to enter 1 time per day. I've discovered that mysql has a timediff() function. I'm thinking that each time a user enters the contest, it will record the date and time entered, and will also add 1 to their count of entries. It would also check the times in the entry, and using timediff(), calculate that 24 hours have passed since the last entry.
Forgive me if it looks crude, but I've sketched up what the code might would look like:
{ user fills out form correctly }
{ $username = form.email-address }
If user does not exist in database
{ write info to database, $datetoday gets value of current date }
Else (if user exists in database)
{ $datetoday gets value of current date }
If $datetoday == database.datetime where database.username == $username then
“You have already played today. Please wait until tomorrow”
Else
“Thank you for playing”
Can anyone help me, assure me I'm on the right path, or any suggestions?
Please help!