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
|