Joomla · Joomla 1.6 · Joomla 1.7

Joomla 1.7 Tips – How to Reset Article Hits/Counts

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

Joomla 1.7 - Show Single Article Hits
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
Joomla 1.7 Single Article ID
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
Joomla 1.7 - SQL in phpMyAdmin Article ID
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.

Joomla 1.7 Article List with Hits
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.

Joomla 1.7 Reset Article Hits to Zero
Joomla 1.7 Reset Article Hits to Zero

Hope that helps,

Elaine

9 thoughts on “Joomla 1.7 Tips – How to Reset Article Hits/Counts

  1. 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

  2. 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?

    1. 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

    2. 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

  3. 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

    1. 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

    2. 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

Leave a Reply to Tracy Cancel reply

Your email address will not be published. Required fields are marked *

Captcha Captcha Reload