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);?>