PHP dynamic bar chart implementation method _ PHP Tutorial

Source: Internet
Author: User
PHP dynamic bar chart implementation method. PHP dynamic bar chart implementation method this article mainly introduces the PHP dynamic bar chart implementation method. The example shows the php dynamic bar chart implementation technique based on HTML elements, which is very useful and requires PHP dynamic bar chart implementation method.

This article mainly introduces the PHP dynamic bar chart implementation method. The example analyzes php's skills for implementing dynamic bar charts with HTML elements, which is very useful. For more information, see

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:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

// Calculate the day of the previous month

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

}

?>

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 used.

$ D = db ()-> query ($ SQL)-> fetch (PDO: FETCH_NUM );

// Echo "total number of data entries:". $ d [0];

// Query the number of data entries that have passed the review

$ 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.