Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hiya Petras,
Thought I'd carry on a little from where Brer Aristotle left off. I've done many types of this over the years and would like to give a wee bit of advice. I started out by using flatfiles and the exact same technique as above to keep a count (the link went through a CGI opened the appropriate text file and then auto increment the number). However this gets messy pretty quickly and is hard to maintain.

Step in relational Db. I use MySQL but any other SQL Db would suffice. the reason I do this is to allow better control via a backend admin script to control all the elements of the promotion. Below is a basic typical setup I might have for an SQL table containing the fields;

  • UID (Unique ID)
  • Name of promotion (or in your case charity)
  • Clicks (number of hits)
  • Image (usually just a name or path)
  • URL link
  • Header text - optional (HTML)
  • Footer text - optional (HTML)
  • Created (date promotion started)
  • LastMod (date link was last clicked in this case)
  • Active ("Yes" or "No")

This means that your front end (HTML) page interacts directly with your back end admin script (via the Db) meaning that if you are capable of doing this (dynamic page building) not have to edit any hard coded HTML. I gave that up a "long time ago"... ;)

Anyway hopefully that might have given you an insight to a more proactive way of handling this situation. If you have any other questions either reply to this post or /msg barrd in the ChatterBox.

Best of luck...

In reply to Re: Counting click-throughs by barrd
in thread Counting click-throughs by Petras

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (4)
    As of 2020-10-31 02:20 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (286 votes). Check out past polls.