|
Hmmm...I'm not totally sure what you're asking, but let me take a wild guess and see if this at least helps.
Let's say that they get 50 credits per 100 impressions. Then, let's assume that the number of impressions is stored in a variable $impression_count (possibly pulled from a database field). Then, the total number of credits available would be floor($impression_count/100)*50. You could store the total number of credits used in another variable/field and that number would need to be always less than the bolded equation above.
For example, if the user had 248 impressions (i.e. $impression_count=248), then we'd have floor(248/100)*50 = floor(2.48)*50 = 2*50 = 100. If they had used 25 credits, then they'd have 100-25=75 credits available.
Hope that helps.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|