PHP Dynamic Histogram Implementation Method _php tutorial

Source: Internet
Author: User

PHP Dynamic Histogram Implementation method


This article mainly introduces the PHP dynamic Histogram implementation method, the example analysis of PHP with HTML elements to implement dynamic histogram skills, very practical value, the need for friends can refer to the next

The example of PHP dynamic histogram implementation is described in this paper. Share to everyone for your reference. The specific analysis is as follows:

1. Requirements

Query the total number of data in the last one months and the number of approved bars, make a histogram

2. Implementation code:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21st

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

Calculated on the one month of today

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 (date ("Y-m", $last _month_time). "-D", $time);

}

?>

Include DirName (DirName (dirname (__file__)). ' /config.php ';

$endDate = Date (' y-m-d ');

$date = Strtotime ($endDate);

$beginDate = Last_month_today ($date);

Query the total number of data bars for the last one months

$sql = ' SELECT count (*) from Newpro where P_date>\ '. $beginDate. ' \ ' and p_date<\ '. $endDate. ' \'';

$sql = "SELECT count (*) from Newpro where p_date> ' $beginDate ' and P_date < ' $endDate '";//This statement can also

$d = db ()->query ($sql)->fetch (pdo::fetch_num);

echo "Total number of data bars:". $d [0];

Number of data bars passed by the query audit

$sql 2= $sql. ' and Is_pa_check_first=1 and is_pa_check_second=1 and Is_pa_check_third=1 ';

$d 2 = db ()->query ($sql 2)->fetch (pdo::fetch_num);

echo "Number of data bars approved:". $d 2[0];

Query the number of passes for an audit

$sql 3= $sql. ' and Is_pa_check_first=1 ';

$d 3 = db ()->query ($sql 3)->fetch (pdo::fetch_num);

Check the number of passes for two audits

$sql 4= $sql. ' and is_pa_check_first=1 and is_pa_check_second=1 ';

$d 4 = db ()->query ($sql 4)->fetch (pdo::fetch_num);

?>

">

">

">

Total

First Instance passed

Second-Instance Adoption

Audit through

3. As shown below:

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/976532.html www.bkjia.com true http://www.bkjia.com/PHPjc/976532.html techarticle PHP Dynamic Histogram implementation method This article mainly introduces the PHP dynamic Histogram implementation method, the example analysis of PHP with HTML elements to implement dynamic histogram techniques, very practical value, need ...

  • Related Article

    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.