The page view increment isn't working
UPDATE tible SET view=view+1
$query = 'UPDATE '.' news SET view=view+1 WHERE news_id = ?'
$db->Execute($query, array($id));
on the first view, instead of one view it shows two views - every subsequent view is recorded correctly, three, four, etc..
only the first time the view count is displayed incorrectly.... instead of one view it shows 2 ::blink.gif::
this part of the code definitely runs twice
try turning on debug mode and logging the operations?
find out the value before and after the field changes
I checked
at the start of the script's execution - the field value is 0
right after execution - 1
and at the very end of execution it's 1 too, one view
but if you look from phpMyAdmin - it's already 2 views
maybe the script is cached)))) or part of it
or the query is cached
maybe it's MYSQL's delayed write
SELECT SQL_NO_CACHE news SET view=view+1 WHERE news_id = ?
that's how I do the select
maybe it really is two views
maybe someone else is browsing the site too)))
maybe a search bot?)))
check the server log
yes indeed, someone from facebook's servers is making requests))))))))))))))
probably because of some plugin installed on the site)))
I'll figure out which one exactly))))0
Comments