Results 1 to 3 of 3

Thread: Count the Clicks

  1. #1

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909

    Count the Clicks

    How do I keep track of and record the # of clicks on a certain link?

    thanks

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    The easiest way would be to use a MySQL database over flat file.

    Have your link like this: http://www.site.com/tracker.php?link....com/about.php

    Then do something like:

    Code:
    mysql_connect(...);
    $results = mysql_query("SELECT ... WHERE sitename='" . $_REQUEST['link'] . "'");
    
    if ($result = mysql_fetch_array($results)) {
        //exists in database already. update:
        $count = $result['hits'] + 1;
        mysql_query("UPDATE ... SET hits='$count' WHERE ...");
    } else {
        //does not exist. add new entry:
        myql_query("INSERT ... (site, hits) VALUES ('" . $_REQUEST['link'] . "', '1'");
    }
    
    header("Location: " . $_REQUEST['link']);
    Something along those lines. Note that that's all psuedocode off the top of my head and wont automatically work. You need to create the table and fill in a few blanks.

    Hope this helps.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    alright i get the basic idea, thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width