954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Page View count in a session

0
By Denis Sellu on Aug 9th, 2010 8:33 pm

This will count number of page views in a session. Simple, to add on the page just add the code on the top of the page and make sure it is before any html.

<?php
session_start();
if(isset($_SESSION['view']))
{
    $_SESSION['view']=$_SESSION['view']+1;
}
else
{
    $_SESSION['view']=1;
}
echo "Page Views Count On This Session:".$_SESSION['view'];
?>

This code looks cool :)
But it's not very useful to just track the views count on a particular session, isn't it? I thought it might be better to count the total number of views in total.

kyrilkong
Newbie Poster
2 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You