I have placed a function at the end of my webpage to count the views of the thread, the function is as follows
function add_view($thread_id)
{
global $connection;
$qry = "UPDATE tbl_threads SET views = (views+1) WHERE ";
$qry .= "thread_id= {$thread_id}";
mysqli_query($connection,$qry,MYSQLI_STORE_RESULT);
}
This Function is triggered once at the end of the page. But the problem is When I open the page once, and then see in the database there are 4 views.
Some times it adds 3, some times it adds 4 and some times it adds 2 to the view field of tbl_threads.
It looks that my webpage triggered more than once, Is it Possible, (My webpage has Google Analytics and Google Adsense Codes also)
Can Any one analyse the problem ??
What is the solution of this Problem??