how to count page views

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

how to count page views

Post by ecxzqute »

hey guys.. can anyone please help me with this?.. i want to know the or count the number of views, visits, and currently visiting the pages on my site. how am i gonna do this?
samsolomonraj
Forum Newbie
Posts: 12
Joined: Mon Feb 09, 2009 3:34 am
Location: India, Chennai

Re: how to count page views

Post by samsolomonraj »

It is very simple... You can add one update query on that page.
Create one column in the database.

Then select that record on that page from db.. then increment the value by one and then update the value to the database..
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

Re: how to count page views

Post by ecxzqute »

i still don't get it.. can you plz give me a simple sample code?
samsolomonraj
Forum Newbie
Posts: 12
Joined: Mon Feb 09, 2009 3:34 am
Location: India, Chennai

Re: how to count page views

Post by samsolomonraj »

Ye man create one column in your database table like view_count.

Then

$sel1="select * from table_name where condition";
$qry1=mysql_query($sel1);
$res1=mysql_fetch_array($qry1);

$count=$res1['view_count'];

$sel2="update table_name set view_count=".$res1['view_count']."+1 where condition";
$res2 =mysql_query($sel2);


It will surely works..
Bye....
Last edited by samsolomonraj on Wed Mar 18, 2009 7:27 am, edited 1 time in total.
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

Re: how to count page views

Post by ecxzqute »

thanks man... i'll try this at home...
Post Reply