Think i’ve sorted it
[php]
$upd_month = date(‘F’);
$upd_year = date(‘Y’);
mysql_select_db($database_connection, $connection);
$query_hits = “SELECT * FROM property_hits WHERE list_id = ‘$list_id’”;
$hits = mysql_query($query_hits, $connection) or die(mysql_error());
$row_hits = mysql_fetch_assoc($hits);
$totalRows_hits = mysql_num_rows($hits);
$m_toupdate = $row_hits[‘month’];
$y_toupdate = $row_hits[‘year’];
$inc_hits = $row_hits[‘hits’];
$inc_hits = $inc_hits + 1;
if(file_exists($m_toupdate == $upd_month) || ($y_toupdate == $upd_year)) {
mysql_select_db($database_connection, $connection);
$hit_count = “UPDATE property_hits SET hits = $inc_hits WHERE month = ‘$upd_month’ AND year = ‘$upd_year’ AND list_id = ‘$list_id’”;
$hit_result = mysql_query($hit_count, $connection) or die(mysql_error()); }
else {
mysql_select_db($database_connection, $connection);
$hit_count = (“INSERT INTO property_hits ( list_id, hits, month, year) VALUES (’$list_id’, ‘$inc_hits’, ‘$upd_month’, ‘$upd_year’)”);
$hit_result = mysql_query($hit_count, $connection) or die(mysql_error()); }
?>
[/php]
Just gotta wait til next month now and see if it works properly