in reply to Re: newbie table structure
in thread newbie table structure
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 :)"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) )");
(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- how many searchengine entries for a specific dayselect searchengine, date, count(*) from visits group by searchengine, + date order by date desc
- total number of searchengine entriesselect searchengine, date, count(*) from visits where date = '2004-01- +31' group by searchengine, date order by date desc
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.select searchengine, count(*) from visits group by searchengine
Marc Bilodeau
www.marcbilodeau.com
|
|---|