PHP dynamic bar chart ultimate version, php bar chart ultimate version

Source: Internet
Author: User

PHP dynamic bar chart ultimate version, php bar chart ultimate version

This article provides an example of PHP's ultimate version for implementing dynamic bar charts. 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.

<! DOCTYPE html> <? 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);?> <Html> 

The database is easy to avoid. In fact, it is easy to create a test data table based on the queried table name and field name. The key is the idea. No matter how it changes, the idea is the key.

To better understand the code effect, cut a picture.

I hope this article will help you with php programming.

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.