Php daily and monthly statistics code-PHP source code

Source: Internet
Author: User
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; */?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.