sql - how to count visits on a period of time php -
how can count number of visits on page period of time in php , sql
right have field called number of visits every page. number not tell time of visits. not mind opening new column counting visits month. how can that?
why doing that? monthly report showing me website pages improved more other. ideas? codes?
everything welcomed
if it's quick tracking, include counter script each page. here's crude illustration in php:
<?php $datafile = 'pick_a_filename.txt'; if(file_exists($datafile)) { $count = file_get_contents($datafile); $count++; $fp = fopen($datafile, 'w'); fwrite($fp, $count); fclose($fp); } else { $count = 1; $fp = fopen($datafile, 'w'); fwrite($fp, $count); fclose($fp); } ?>
and check created file every month, or add script appends contents statistic file every month. if there's lots of traffic, include lock_ex , random delay before writing count not reset when 2 people write @ same time - has happened me on small site when used lock_ex! random delay fixed it.
Comments
Post a Comment