Counter Code?

by Adam Carn 9 replies
I need a simple code for my website. Here's what I need.

I need a hit counter for my subscriber "thank you" page but I want the counter to show on my main homepage.

There are hundreds of counter scripts and that's fine but I don't know how to count hits to my thank you page and show it on the homepage.

Any ideas?

Thanks
Adam
#programming #code #counter
Avatar of Unregistered
  • Profile picture of the author jlandells
    Adam,

    If you have a MySQL database, you could easily log each hit into the DB, then just query it on the main page. This would be your best bet.

    -John.
    {{ DiscussionBoard.errors[453366].message }}
    • Profile picture of the author Bruce Hearder
      This is easy to do..
      What counting code are you running at the moment..

      Bruce
      {{ DiscussionBoard.errors[453382].message }}
  • Profile picture of the author n7 Studios
    Adam,

    I'd be interested to know what reason(s) you have for wanting to display something like that on a web site. It's a phase that's passed most web development a few years ago.

    If you're wishing to concentrate on analysing your visitors, something like Google Analytics will give you a page by page breakdown.

    Tim.
    {{ DiscussionBoard.errors[453412].message }}
    • Profile picture of the author Bruce Hearder
      I could imagine a couple of reason for doing something like this,
      eg. Wants to show how many people have signed up to his newsletter, when he can't get the numbers from his Autoresponder company..

      Plenty of reason to do something like this..

      Any thoughts on that code?

      Bruce
      {{ DiscussionBoard.errors[453428].message }}
      • Profile picture of the author Adam Carn
        Originally Posted by Bruce Hearder View Post

        I could imagine a couple of reason for doing something like this,
        eg. Wants to show how many people have signed up to his newsletter, when he can't get the numbers from his Autoresponder company..

        Plenty of reason to do something like this..

        Any thoughts on that code?

        Bruce
        This is the code for the thank you page:

        --------------------------------------

        <?php
        require_once('counter/counter.php');
        do_counter_hit('1');
        ?>

        <?php

        show_counter('1');

        ?>

        ---------------------------------------

        I would like to show this thank you page counter on my homepage (index.php)

        Any solutions?

        Adam
        Signature
        Taking a break...
        {{ DiscussionBoard.errors[453520].message }}
  • Profile picture of the author Bruce Hearder
    Ok..

    Put this on the thank you page :
    Code:
    <?php
    require_once('counter/counter.php');
    do_counter_hit('1');
    ?>
    Then put this on the index.php page
    Code:
    <?php
    require_once('counter/counter.php');
    show_counter('1');
    ?>

    It should all work OK now..

    Let me know how things go

    Bruce
    {{ DiscussionBoard.errors[453547].message }}
    • Profile picture of the author Adam Carn
      Originally Posted by Bruce Hearder View Post

      Ok..

      Put this on the thank you page :
      Code:
      <?php
      require_once('counter/counter.php');
      do_counter_hit('1');
      ?>
      Then put this on the index.php page
      Code:
      <?php
      require_once('counter/counter.php');
      show_counter('1');
      ?>

      It should all work OK now..

      Let me know how things go

      Bruce
      Thanks Bruce, It worked! I really appreciate your help!

      Adam
      Signature
      Taking a break...
      {{ DiscussionBoard.errors[453633].message }}
      • Profile picture of the author Bruce Hearder
        No problems..

        Glad to be of assistance..

        Take care

        Bruce
        {{ DiscussionBoard.errors[454918].message }}
  • Profile picture of the author jerson
    MySql is the solution
    {{ DiscussionBoard.errors[499968].message }}
Avatar of Unregistered

Trending Topics