tryagain Posted February 22, 2006 Posted February 22, 2006 Is there an easy way to delete the previous years of banner history? I have been deleting it line by line in the database but there has to be an easier way. Thanks
tryagain Posted February 23, 2006 Author Posted February 23, 2006 I should also mention I have done a search to with no luck.
Guest Posted February 23, 2006 Posted February 23, 2006 open your catalog\includes\functions\banner.php locate this code: //// // Update the banner click statistics function tep_update_banner_click_count($banner_id) { tep_db_query("update " . TABLE_BANNERS_HISTORY . " set banners_clicked = banners_clicked + 1 where banners_id = '" . (int)$banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')"); right below it add this code: tep_db_query("delete from " . TABLE_BANNERS_HISTORY . " where (curdate()+0) > ((date_format(banners_history_date, '%Y%m%d')+0)+10000)"); Then when someone clicks a banner the code will delete the banner history that's over a year's old.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.