I write some simple article scripts. Now I want add some article counter.
If there have 3 possibility it should make an article counter.
- the article has been opened for read.(only one whole article per page, it will count 1 time)
- the article has been searched in a content search list(with title and short content description 5 items per page, it will count 1 time. then if open to read whole article content, it will count another 1 time.)
- the article has been showed in the home page by Random (with title and short description, it will count 1 time)
Is there any good suggestion how to do these better?
Which database design is better? put article and count number in one table? or make two tables?
Can anyone recommend me some php article counter script, if the main rules write into a file like class.php then include into my every page.
Thanks.
What you could do is use the database that auto increments and just increment that value when the page is viewed, and display that value if you want.
Here is how you can setup the auto increment.
Then update the “value” (you don’t have to actually update anything it will AI)
Then just display the view
This is off the top of my head – it should work.