Forum Moderators: open
What i would like to do is to reset one of those columns at the beginning of each month. So i will end up with a column for total visits and a column for monthly visits.
I would prefer to do this via the web page rather than a cron job. Any ideas?
My thought was to include a script at the beginning of each page which will check for the date but i don't really know where to start. I hope someone can help me, thanks in advance.
Also not sure if i have posted this in the correct forum it could be in a php forum.
Assuming that you've got the last visit date (or at least the month and year of the last visit stored with the user), then pcode for what you want to do would be
if (currentmonth > storedmonth and currentyear >= storedyear) or (currentmonth <= storedmonth and currentyear > storedyear) then reset count to 1
I believe this solves your problem, and takes care of the year rollover as well.
- Jon