I want a hit count increase when someone clicks on the details link. Anyone know how to do this?
I want a hit count increase when someone clicks on the details link. Anyone know how to do this?
Create this new function in link.class.php :
function Increase_Hit($id) {
// get current hits
$query = "select hits, url from $this->table_name where link_id=$id";
$result = $this->db_connect->Execute($query);
$url = $result->Fields("url");
$hits = $result->Fields("hits");
// update hits
$query = "update $this->table_name set hits = ($hits + 1) where link_id = $id";
$result = $this->db_connect->Execute($query);
}
Then, insert this code in detail.php after ShowDetailPage() :
$links_obj = new clsLink;
$links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassw ord,$dbName);
$links_obj->table_name = "idx_link";
$links_obj->Increase_Hit($id);
Thank You Sofiah, this is awesome. Hits are increasing with a few tricks and people now think the website is busy. Great tactics for all website designers to use, to increase website traffic.
I get this error trying to implement this hack.
Fatal error: Cannot redeclare Increase_Hit() in ../lib/link.class.php on line 3327
Sofia,
Please assist.
Than k you
Binto
you have to be careful with words being cut off when copying and pasting code from forum to file.
Try double checking it to see words like pass
word
don't get cut off and others.
I had this problem too once.
Hart
I have managed to stop the error messages but the count is not increasing.
What I have done is when someone clicks on a listing, they are directed to the details page. At this point, I would like the count to increase.
Now, it is only increasing if someone clicks on the go.php link in the details page.
Hart, Please throw some light.
Thank you
Binto,
It should be work as what you want. Please attach your detail.php and link.class.php into this forum or send to my email at sofiah@nicecoder.com, I want to see the scripts.
Sofiah