Dynamic bar chart in PHP

Source: Internet
Author: User
This article mainly introduces PHP's dynamic bar chart simplified version, which is an improvement based on the implementation of the bar chart described above. it has some reference value, for more information about how to implement dynamic bar charts in PHP, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:

I have already written about the principle of making only dynamic column charts. Because there was a new demand yesterday afternoon, I modified it again this morning and displayed the data in the table according to the number.

The following code is pasted out to facilitate future display. The idea is just a spark. today I want to do this, and I don't have to think about it next time, therefore, writing notes is a good form.

<? 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 ); $ SQL = 'SELECT count (*) from newpro where p_date> \''. $ beginDate. '\' and p_date <\''. $ endDate. '\ '''; $ d = db ()-> query ($ SQL)-> fetch (PDO: FETCH_NUM); $ 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); $ sql3 = $ SQL. 'and is_pa_check_first = 1'; $ d3 = db ()-> query ($ sql3)-> fetch (PDO: FETCH_NUM); $ sql4 = $ SQL. 'and is_pa_check_first = 1 and is_pa_check_second = 1'; $ d4 = db ()-> query ($ sql4)-> fetch (PDO: FETCH_NUM ); // query the situation where each person passes the review: $ sqlab = 'SELECT d_m, sum (sroce) as total_score, count (d_m) as total_number from newpro where is_pa_check_first = 1 and is_pa_c Heck_second = 1 and is_pa_check_third = 1 group by d_m'; $ row = db ()-> query ($ sqlab)-> fetchAll (PDO: FETCH_ASSOC);?>  
   

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.