PHP dynamic bar chart implementation method, php dynamic bar chart _ PHP Tutorial

Source: Internet
Author: User
PHP dynamic bar chart implementation method, php dynamic bar chart. PHP dynamic bar chart implementation method. This article describes how to implement php dynamic bar chart. Share it with you for your reference. The specific analysis is as follows: 1. query the latest PHP dynamic bar chart implementation method, php dynamic bar chart

This article describes how to implement the PHP dynamic bar chart. Share it with you for your reference. The specific analysis is as follows:

1. requirements

Query the total number of data records and the number of records that have been approved in the last month to form a column chart.

2. implementation code:

<? Php // calculate the function last_month_today ($ time) {$ last_month_time = mktime (date ("G", $ time), date ("I ", $ time), date ("s", $ time), date ("n", $ time), 0, date ("Y", $ time )); $ last_month_t = date ("t", $ last_month_time); if ($ last_month_t <date ("j", $ time) {return date ("Y-m-t H: i: s ", $ last_month_time);} return date (" Y-m ", $ last_month_time ). "-d", $ time) ;}?> <? Php include dirname (_ FILE __))). '/config. php '; $ endDate = date ('Y-m-D'); $ date = strtotime ($ endDate); $ beginDate = last_month_today ($ date ); // query the total number of data entries in the last month $ SQL = 'SELECT count (*) from newpro where p_date> \''. $ beginDate. '\' and p_date <\''. $ endDate. '\ '''; // $ SQL = "select count (*) from newpro where p_date>' $ inindate 'and p_date <' $ endDate '"; // This statement can also be $ d = db ()-> query ($ SQL)-> fetch (PDO: FETCH_NUM); // echo "total number of data entries :". $ d [0]; // number of data records that have been approved by the query $ sql2 = $ SQL. 'and is_pa_check_first = 1 and is_pa_check_second = 1 and is_pa_check_third = 1'; $ d2 = db ()-> query ($ sql2)-> fetch (PDO: FETCH_NUM ); // echo "number of data records approved :". $ d2 [0]; // query the number of items that have been approved at a time $ sql3 = $ SQL. 'and is_pa_check_first = 1'; $ d3 = db ()-> query ($ sql3)-> fetch (PDO: FETCH_NUM ); // query the number of items that pass the secondary review $ sql4 = $ SQL. 'and is_pa_check_first = 1 and is_pa_check_second = 1'; $ d4 = Db ()-> query ($ sql4)-> fetch (PDO: FETCH_NUM);?>        
           

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.