Joomla 1.7 Tips – How to Reset Article Hits/Counts

by Elaine on September 1, 2011

Joomla 1.7 Help – Resetting your Article hit counter

Before you push your Joomla website into production you will perform tests on the frontend with different users, different articles, access to modules and different menus and more.  Since this is a CMS, content will appear on every page.  Once you click to open an article, the article counter increments.  So by the end of the whole testing process, some article counters might reach into the hundreds.   If you chose to display this article feature – Hits, you should reset this counter back to zero before your Joomla website goes into production.   In Joomla 1.5 there was an article reset counter button, but that has disappeared.  So now the only way to do this is to perform SQL queries in your MySQL database using phpMyAdmin.

So I have 2 scenarios:

  • Reset the article counter for one article
  • Reset the article counter for all articles

Below, I, Elaine @ Cmsmind.com will show you how to do both of these options.  Overview of what you need to do.

  • Find the Article ID in Article Manager
  • Access MySQL database in phpMyAdmin
  • Run Select query to check the ID in phpMyAdmin
  • Run Update query to update all article hit counter to zero in phpMyAdmin

How to Reset the Article Counter for One Article

joomla17 elaine cmsmind show article hits Joomla 1.7 Tips   How to Reset Article Hits/Counts

Joomla 1.7 - Show Single Article Hits

1. Find the Article ID in the Article Manager

  • Login to your Joomla 1.7 Administrator Backend
  • Click on Content, Article Manager, Filter for your article
  • See the far right column is ID, note that number down.  In my case the article ID = 35
joomla17 elaine cmsmind article hits id Joomla 1.7 Tips   How to Reset Article Hits/Counts

Joomla 1.7 Single Article ID

2.  Access MySQL database in phpMyAdmin (here comes the tricky part)

First you will confirm that this is the article that you want the counter reset.

  • Login to your backend MySQL phpMyAdmin
  • Expand your database on the left navigation and you will see a list of table names.
  • Find your table name.  In my case it is: cmsmind_content
  • In the main frame, you will see 8 tabs – Browse, Structure, SQL, Search, etc.
  • Click on the tab ‘SQL’
  • In the big white box where you enter your SQL statement.  Note the ID is the value in Step 1.  Type the following:

Select * from cmsmind_content where ID = 35

  • Click on GO
joomla17 elaine cmsmind phpmyadmin article hits id Joomla 1.7 Tips   How to Reset Article Hits/Counts

Joomla 1.7 - SQL in phpMyAdmin Article ID

3.  Run Update query to update single article hit counter to zero in phpMyAdmin

Once you are sure that you have the correct article, you can update the counter value to zero

  • In the SQL box, type in the following:

Update cmsmind_content where ID=35 set hits=0

  • Click on GO

Now go back to your Joomla 1.7 frontend and reload the article.  The Article count will be 0.

How to Reset the All Article Hit Counts

You can reset article counter for selected articles, all articles, article category, published only articles and any other article feature.  You just need to specify these criterias in your SQL statement in the ‘Where’ clause.

joomla17 elaine cmsmind article hits Joomla 1.7 Tips   How to Reset Article Hits/Counts

Joomla 1.7 Article List with Hits

4.  Access MySQL database in phpMyAdmin

First you will confirm that these are the articles that you want the counter reset.

  • Login to your backend MySQL phpMyAdmin
  • Expand your database on the left navigation and you will see a list of table names.
  • Find your table name.  It will be prefixed with your database name.  In my case it is: cmsmind_content
  • In the main frame, you will see 8 tabs – Browse, Structure, SQL, Search, etc.
  • Click on the tab ‘SQL’
  • In the big white box where you enter your SQL statement.  Type the following:

Select * from cmsmind_content

  • Click on GO

5.  Run Update query to update all article hit counts to zero in phpMyAdmin

Once you are sure that you have the correct article, you can update the counter value to zero

  • In the SQL box, type in the following:

Update cmsmind_content set hits=0

  • Click on GO

Afterwards you can refresh your Joomla 1.7 website and you will see all your article counter hits set to zero.

joomla17 elaine cmsmind reset article hits zero Joomla 1.7 Tips   How to Reset Article Hits/Counts

Joomla 1.7 Reset Article Hits to Zero

Hope that helps,

Elaine

 Joomla 1.7 Tips   How to Reset Article Hits/Counts

Elaine

Elaine is the founder of CmsMind, an online blog providing Joomla and Wordpress tutorials. Elaine lives in Toronto and when she is not online, she is either Marathon and Triathlon training or travelling and racing somewhere in the world. Find her also at: Save Money, Premium Themes and Templates, and at Webhosting Tips.

More Posts - Website

{ 9 comments… read them below or add one }

Tracy December 18, 2011 at 12:13 am

this was great, cause I just started working with 1.7 and I know 1.5 had the resets.I wonder why they got rid of that.

You seem to know alot, I was wondering why my sub menus on the side in 1.7 do not work if I use the system cache with the plug in. I use artisteer 3 to do my templates.

Thanx for your time

Reply

Astin de Zeeuw February 16, 2012 at 3:14 pm

Elaine,

I tried it in sql 5 but didn’t work. Get the error; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘set count hits=0 LIMIT 0, 30’ at line 1

can you help me?

Reply

Elaine February 16, 2012 at 10:58 pm

Hi Astin,
You need to select the article id – Check step 1 – the article id is at the far right column in the Article Manager.
You also need to include in your sql statement the content table name. Usually it’s PREFIX with a letters, but you need to change your SQL statement to include that…

so should look like – Change the code in bold to your information
Select * from PREFIX_content where ID = ## <--- article id from step 1 Then you can do an update - - Change the code in bold to your information Update PREFIX_content where ID=## set hits=0 Hope that helps, elaine

Reply

Elaine March 2, 2012 at 2:29 pm

Hi Astin,
Sorry for the late response. I’ve created a new post for you for Joomla 2.5 and how to reset article hit counter. The post is here.
Thanks for your visit,
elaine

Reply

Mark February 24, 2012 at 3:44 am

Hi Elaine, Austin,

I too got the error:
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘where ID=280 set hits=0’ at line 1

and this is the sql query I used:
Update j17_content where ID=280 set hits=0

What have I done wrong?

Thanks, Mark

Reply

Elaine February 25, 2012 at 1:46 pm

Hi Mark,
Sorry about that, I will look into it and create a new tutorial for Joomla 2.5 this week. I will let you know when I’ve completed it.
Thanks for your visit,
elaine

Reply

Elaine March 2, 2012 at 2:31 pm

Hi Mark,
Sorry for the late response. I’ve created a new post for you for Joomla 2.5 and how to reset article hit counter. The post is here.
Thanks for your visit,
elaine

Reply

Christoph April 7, 2012 at 4:08 pm

Thank you for your help.
The hits were all reseted and with your instruction it was ver easy.

Reply

Elaine April 7, 2012 at 5:26 pm

Hi Christoph,
No problem. Glad I could help you! 🙂
Thanks for your visit,
elaine

Reply

Leave a Comment

Captcha Captcha Reload

Older Post:

Newer Post: