Divyesh
Collapse
X
-
Tags: None
-
Parveen K - Forum Administrator
SEO India - TalkingCity Forum Rules - Webmaster Forum
Please Do Not Spam Our Forum -
Batch Counting
This is the current function but the thing is I want to speed the site up and just having that 1 extra connection will affect it loads. This function is called on every page.
PHP Code:function daily_counter() {
//Daily counter
$today = date("Y",time()) . "-" . date("m",time()) . "-" . date("d",time());
$counter_check = mysql_query("SELECT counter_id, cdate, counter FROM nn_counter ORDER BY cdate DESC LIMIT 1") or die(mysql_error());
$my_counter = mysql_fetch_array($counter_check);
if ($today == $my_counter['cdate']) {
$update_count = mysql_query("UPDATE `nn_counter` SET counter = counter + 1 WHERE cdate = '$today'") or die(mysql_error());
} else {
$update_count = mysql_query("INSERT INTO `nn_counter` (counter_id, cdate, counter) VALUES ('', '$today', 1)") or die(mysql_error());
}
}
Paxil side effectLast edited by Deevyesh Tyagi; 04-12-2011, 10:37 PM.Comment
Comment