Randal's method is better. There is less to management. I would change the date to a MySQL date field which will store information as YYYY-MM-DD.
"CREATE TABLE IF NOT EXISTS visits ( id int auto_increment not null, searchengine char(48) NOT NULL, useragent char(32) NOT NULL, ip char(32) NOT NULL, date date NOT NULL, primary key (id) )");
You may have to use some perl magic to format the date appropriately. Although this probably not the most efficient way to write this, it demonstrates my point :)
(undef, undef, undef, $Day, $Month, $Year, undef, undef, undef) = loca +ltime(time); $Month++; $Year += 1900; $MySQLDate = "${Year}-${Month}-${Day}";

By including the searchengine field and a little extra work, you can also create some great reports such as:

- how many searchengine entries per day
select searchengine, date, count(*) from visits group by searchengine, + date order by date desc
- how many searchengine entries for a specific day
select searchengine, date, count(*) from visits where date = '2004-01- +31' group by searchengine, date order by date desc
- total number of searchengine entries
select searchengine, count(*) from visits group by searchengine
And other reports based on IP addresses, specific useragents, and so on... You could also pass that information to GD::Graph::Bar and create some nice looking bar graphs that management will like. Even get more crafty and email them routinely to people using MIME::Lite and a cron job. These search engine can be found CPAN.

Marc Bilodeau
www.marcbilodeau.com


In reply to Re^2: newbie table structure by FitTrend
in thread newbie table structure by coldfingertips

Title:
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, details, 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, summary, 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.