Welcome Guest, Not a member yet? Register   Sign In
How to add a counter to a MySQL Table?
#2

[eluser]davidbehler[/eluser]
- Add a column named "ads_click_count" or something like that to your table
- The link on the Ad should be to one of your sites, e.g. ads/view/ad_id
- On that site you simply update the ads table for ad_id and increase the counter field by one, e.g.
Code:
$query = "Update ads set ads_click_count = ads_click_count + 1 where ads_id = ".$this->db->escape($ads_id).";";
// You could use active records aswell
- After updating the counter you redirect to the real destination of the ad, e.g.
Code:
redirect('http://www.google.de');

That should be it. There are more ways to do this, e.g. use Javascript, but that's what I came up with in a hurry


Messages In This Thread
How to add a counter to a MySQL Table? - by El Forum - 07-30-2009, 11:17 PM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 12:38 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 02:22 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 03:28 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 03:58 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 09:48 PM
How to add a counter to a MySQL Table? - by El Forum - 09-06-2009, 08:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB