Php Daily Weekly/Monthly Statistics Code jumps
ExecuteNoneQuery2 ($ SQL _tongji); // if this article does not exist, insert a new if ($ rs GetOne ($ SQL _typeid ); $ query = "insert into '$ tableName' VALUES ($ field_id, $ t_row [typeid], 1, 1, 1, $ nowDateArray [0]);"; $ dsql-> ExecNoneQuery ($ query);} else {$ result = $ dsql-> GetOne ($ SQL _tongji); $ oldTimeStamp = $ result ['lasttime']; // last click Time $ m_total = $ result ['m _ total']; // monthly click $ w_total = $ result ['W _ total']; // weekly click $ d_total = $ result ['d _ total];/ /Daily Click $ t_total = $ result ['t _ total]; // total click $ oldDateArray = getdate ($ oldTimeStamp ); // count the current month if ($ nowDateArray ["year"] = $ oldDateArray ["year"] & $ nowDateArray ["mon"] = $ oldDateArray ["mon"]) {$ m_total ++;} else {$ m_total = 1;} // collects statistics for this week $ tmpStartDate = mktime (, 0, $ nowDateArray ["mon"], $ nowDateArray ["mday"], $ nowDateArray ["year"])-($ nowDateArray ["wday"] * 86400); $ tmpEndDate = mktime (, 59, 59, $ nowDat EArray ["mon"], $ nowDateArray ["mday"], $ nowDateArray ["year"]) + (6-$ nowDateArray ["wday"]) * 86400 ); if ($ oldTimeStamp >=$ tmpStartDate & $ oldTimeStamp = $ dayStart & $ oldTimeStamp ExecuteNoneQuery ("update $ tableName set m_total = $ m_total, w_total = $ w_total, d_total = $ d_total, t_total = $ t_total, lasttime = $ nowDateArray [0] where aid = $ field_id "); $ dsql-> ExecuteNoneQuery (" update de_archives set click = $ t _ Total where id = $ field_id "); $ re_total = $ t_total;} return $ re_total;} countdown ($ aid ); // method call/* // mysql TABLE structure create table if not exists 'dede _ tongji '('aid 'Int (11) not null, 'CID' smallint (5) not null, 'tid' smallint (5) not null, 'M _ total' int (11) not null default '1', 'W _ total' int (11) not null default '1', 'd _ total' int (11) not null default '1', 't_ total' int (11) not null default '1 ', 'lasttime' int (12) not null, primary key ('aid ') ENGINE = MyISAM default charset = latin1; */?>