Results 1 to 7 of 7

Thread: Details hit

  1. #1
    Join Date
    Aug 2001
    Location
    Toronto, Ontario
    Posts
    678

    Default Details hit

    I want a hit count increase when someone clicks on the details link. Anyone know how to do this?

  2. #2
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    211

    Default

    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);

  3. #3
    Join Date
    Aug 2001
    Location
    Toronto, Ontario
    Posts
    678

    Default

    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.

  4. #4
    Join Date
    Oct 2001
    Posts
    94

    Default How to implement?

    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

  5. #5
    Join Date
    Aug 2001
    Location
    Toronto, Ontario
    Posts
    678

    Default

    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

  6. #6
    Join Date
    Oct 2001
    Posts
    94

    Default Count not increasing

    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

  7. #7
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    211

    Default

    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

Similar Threads

  1. Replies: 12
    Last Post: 06-01-2004, 12:00 PM
  2. Replies: 2
    Last Post: 02-18-2004, 11:32 AM
  3. Replies: 5
    Last Post: 06-04-2003, 06:12 AM
  4. details page ?
    By Hart_House in forum v5.x
    Replies: 0
    Last Post: 09-23-2002, 07:11 PM
  5. Details page
    By craven in forum v5.x
    Replies: 7
    Last Post: 08-07-2002, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •