I want to record number of advertisement impressions and clicks per day in database. I'm using PHP to insert and update that data in mysql.
The script that display specific advertisement and store data in db looks like:
...count the number of rows in db with this advertisement ID ...
if ($total == "0") {
mysql_query("INSERT INTO impressions VALUES ('".$id."','1','0',NOW('')");
}else{
mysql_query("UPDATE impressions SET impressions=impressions+1 WHERE id=$id;
}
Table in mysql database:
id | impressions | clicks | date
------------------------------------------
5 | 104 | 23 | 2010-06-23
Can I somehow use limit for the number of impressions per day?
For example if advertiser wants to limit impressions of his add to 5000 per day.
How can I do that?