I'm making a visit counter for a page, and using the following code in its own php file, which is only being called once. However, the increment is increasing by 5 each time. I've examined the page many times, and confirmed that the snippet is only being called once. There must be some reason that the increment is increasing by 5, rather than one, I'm missing something, what are the possibilities?
<?php
// property visit counter
include("admin/includes/db_open.php");
function increaseViewCount($propID,$currentCount){
global $MyDB;
$MySQL = "SELECT DISTINCT prop_visitCount FROM ap_property WHERE property_ID = ". $propID;
$MyQuery = mysql_query($MySQL,$MyDB) or die(mysql_error());
$MyRowCount = mysql_num_rows($MyQuery);
//if ($MyRowCount > 0){
$this_count = $currentCount;
$this_count++;
$UpdatePropCount = "UPDATE ap_property SET prop_visitCount = ". $this_count . " WHERE property_ID = " . $propID;
$PropCountQuery = mysql_query($UpdatePropCount,$MyDB) or die(mysql_error());
//}
mysql_free_result($MyQuery);
return $this_count;
}
$count = increaseViewCount($_GET['property_ID'],$property_VisitCount[0]);
include("admin/includes/db_close.php");
?>