Menu
  • HOME
  • TAGS

PHP MySQL image hit counter

php,mysql,image,hitcounter

You need to split the hit counter into array with each value containing single digit, and then use for loop to append images. <?php $array = str_split($your_hit_variable_from_mysql); if(!empty($array)){ foreach($array as $single){ echo '<img src="'.$single.'.jpg"'>; } }else{ echo '<img src="0.jpg"'>; } ?> Ensure you are storing number in integer format ,...

PHP page hit counters in database

php,mysqli,analytics,hitcounter

First, create your database table VISITOR_COUNT. You will need at least two columns - SHOW_ID and COUNT. The code in show.php could look something like this: If you want to count unique (or sort of unique - you can never be completely sure) visitors, check if a specific cookie for...

PHP - Hit counter textfile reset

php,web,refresh,hitcounter

This is a pretty poor way to maintain a counter, but your problem is probably that when you fire multiple requests at the site, one of the calls to file_exists() is getting a false because one of the other processes is removing and recreating the file. If you want this...

Using Foreach for website. I want a hit counter using PHP & MSQL

php,counter,hit,hitcounter

Here's what worked for me. You can modify it as per required. What needed to be done was to pass an additional GET parameter for the related "id" in the URL, then pass that variable for it in the WHERE clause. A header was also added in order to automatically...