Earn money online being a Web Entrepreneur
4 Sep
People who run blogs, and people who enjoy earning money online usually love statistics. I know, personally, that I check my keywords, traffic and revenue streams a couple times a day. I make sure that I know exactly which keywords and threads people are interested in, so that I can work my future posts around them. On top of this, people are like sheep, they follow what others do. If there is a post which has many comments on it, the chances are, other people will show interest to this thread rather than another thread.
Displaying the number of times a thread has been read, is a useful way to control the traffic coming to your website. This can be tied hand in hand with advert placement, and so much more.
In order to display the number of reads each of your articles has had is fairly straight forward, here is my example:
create table mostAccessed
(
postnumber int not null,
cntaccess int not null,
primary key(postnumber),
unique id(postnumber)
);
That’s it! Follow these steps carefully. It is vital that you place the <?php if ($id > 0) { add_count($id); } ?> code in the single.php file and not in your index file. If you place the code in your index.php file, each time the page is loaded, each post will increase the read count, which is definitely not what we want. The second code snippet you deal with, can however be placed in your index.php file - this will show the reads per post in your home page for each article.
Good luck!
Leave a reply