View Single Post
  #8  
Old 02-06-2010, 04:10 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 18,018
BMR777 is on a distinguished road
Default RE: Limit clicks/day to 10, for each pet?

Quote:
Originally Posted by Quillink
:o

Lol. Trust me to pick the abstract, complex way right off the bat. I'll definitely do that Brandon, thanks for suggesting it. :D

EDIT: It's really hard to see if it's working, but does this look functionable to you guys?
Code:
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and date = '$date'";
$result = mysql_query($query);
$ctd = mysql_numrows($result);

if ($ctd <= 9) { $addclicks = 1; }
else 		  { $addclicks = 0; }

$newclicks = $totalclicks + $addclicks;
It looks like it should work, but why not just check if you should add the click or not and if not just don't do the database queries and instead show the user an error message. On a large site there's no need to run unnecessary queries. :)

You'll be able to tell if it is working too that way. :)
Reply With Quote