If that they have 50 credits per 100 impressions, then let's expect that the number of impressions is kept in a variable $impression_count. Then, the total number of credits available would be floor($impression_count/100)*50. You could keep the total number of credits used in another variable/field and that number would need to be always less than the above equation.
For an example:
Quote:
|
If you had 250 impression (i.e. $impression_count=248), then you'd have floor(250/100)*50 = floor(2.50)*50 = 2*50 = 100. If they had used 30 credits, then they would have 100-30=70 credits available.
|