1.

How can you implement hit counter to avoid loss of count data with each restart of the application?

Answer»

You can follow the below steps −

  • Define a database table with a single count, let us say hitcount. Assign a zero value to it.

  • With every hit, read the table to get the value of hitcount.

  • Increase the value of hitcount by one and update the table with new value.

  • Display new value of hitcount as total page hit counts.

  • If you want to count hits for all the pages, implement above logic for all the pages.



Discussion

No Comment Found