View counter

Asked

Viewed 54 times

0

I’m making an application in PHP and would like to do a counter to keep track of each view that the application pages have and store in a database, but I don’t have much idea how to do this.

  • your application will have database connection? If so, which?

  • Edith your question and put the code you have tried!

2 answers

0


In the table where the information on this page is stored, put a field int to store the number of views.

Whenever the page is accessed, it takes the current value of the field and adds +1, then it does the update in the table to update the counter.

-1

Create a database and every time someone accesses your page you increase a record in some table in the database, or else you do it in a local file and always check either the bank or the file when the page is loaded.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.