MySQL Forums :: Newbie :: Counters


Advanced Search

Counters
Posted by: Geoff Forster ()
Date: March 14, 2009 02:47AM

Hi,

I'm using a CMS and would like to create my own counter.

Ideally long term I'd like to have something like this:

A table ('daily_temp') with Date, Section, Story_Number

A Cron job to run at Midnight to total ('daily_temp') and store in the permanent table of records. Including keeping a table of record breaking totals, monthly and yearly etc. Clean 'daily_temp'.

But to start with I'd like a fast solution and get some help with setting up the temp table so I can get yesterday's totals and display them.

I have created the table, but is it better to add records and then use count() to get totals or have one record for (DATE+Section+Story_Number) and increment it?

If it's the latter how do I check for a change of date at midnight and Insert the records for the first page visits of each day?

Thanks
Geoff



Edited 2 time(s). Last edit at 03/14/2009 03:11AM by Geoff Forster.

Options: ReplyQuote


Subject Written By Posted
Counters Geoff Forster 03/14/2009 02:47AM
Re: Counters Rick James 03/15/2009 11:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.