Setup Competition Form to allow 100 entries per day

I hope someone can help??

I need to set up a competition entry page to allow 100 people per day to enter.

After the 100th entry, I need to the form to not be visible, and a message to say “please try again tomorrow”

Can anybody help?

Have it count how many entries have been entered for date(dmy);
If $len =>100 error. wait for tomorrow.

Thanks. It is the ‘wait for tomorrow’ bit that I am not sure about.

I roughly know how to add the entries to the DB, then show the form if the value is below 100, but I am not sure how to do the date bit.

Think I’ve sussed it…

[php]$result = mysql_query(“SELECT * FROM table1 WHERE DATE(date) = DATE(NOW())”);
$num_rows = mysql_num_rows($result); [/php]
Then…
[php] if($num_rows < 100)
echo “DISPLAY THE FORM INFO HERE”;
else
echo “I’M SORRY, TRY AGAIN TOMORROW”;
[/php]

Pretty much.
I’m not sure if DATE(NOW()) will record minutes and seconds.
If it does you could just store $date = date(dmy);
As long as you store the date in the same format.
[php]$result = mysql_query("SELECT * FROM table1 WHERE date = ‘$date’ "); [/php]

Also you want to make sure that when people get to the form, if the entry count is 98 and 5 people get to the form page at the same time (it could happen) remember to do a check again before entering the entries into the database.

Sponsor our Newsletter | Privacy Policy | Terms of Service