forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: bmn on September 04, 2009, 06:24:39 pm

Title: [Solved]: Maybe possibility to recover deleted hits-counter!?
Post by: bmn on September 04, 2009, 06:24:39 pm
Hi there,

Maybe is it better to post  here, then in the Dev corner.

Ok, it now happend  to me. I deleted the hits-counter records.  Shame on me, but that radio button tricked me out. I then changed the util.php.  . . .

The reason why I post is, that there is maybe a possibility to recover the hits-counter. In the database there is a table called "hit_stats". For each PID which is equal to a picture in the gallery there is a line for each hit on a picture. Is there a way to count the hits for each PID in the "hit_stats" and then write the result or sum for each PID in the row "hits" in the "pictures" table?  I donīt know how to do that.

Is there a way?


Title: Re: Maybe possibility to recover deleted hits-counter!?
Post by: Nibbler on September 04, 2009, 06:30:12 pm
Run an SQL query like this in phpMyAdmin

Code: [Select]
UPDATE cpg_pictures AS p SET hits = (SELECT COUNT(*) FROM cpg_hit_stats AS s WHERE s.pid = p.pid)

change the table names as required.
Title: Re: Maybe possibility to recover deleted hits-counter!?
Post by: bmn on September 05, 2009, 09:33:39 am
Run an SQL query like this in phpMyAdmin

Code: [Select]
UPDATE cpg_pictures AS p SET hits = (SELECT COUNT(*) FROM cpg_hit_stats AS s WHERE s.pid = p.pid)

change the table names as required.

Thanks! I will try that.

At all with the same problem: donīt forget to backup your database first  ;)
Title: Re: Maybe possibility to recover deleted hits-counter!?
Post by: bmn on September 22, 2009, 02:12:04 pm
Hi!

Thanks to Nibbler! It worked!!

Greets