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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
<?php include("./_common.php"); ?>
<?php
if($flg == "movie") {
$sql = "SELECT sum(count) AS cnt, page_kr FROM mBoard_page_count WHERE inflow_date BETWEEN '{$txtdate}' AND '{$txtdate2}' AND page = 'youtube' GROUP BY page_kr ORDER BY page_kr ASC"; $res = mysql_query($sql,$connect_web); if(!$res) { echo "µ¥ÀÌÅÍ Ãëµæ¿¡ ½ÇÆÐÇß½À´Ï´Ù. <br>".mysql_error(); } ?>
<style> table { border-collapse: collapse; border-spacing: 0; border: 0 none; } .counter_table th { width: 195px; } .counter_table th, .counter_table td, .counter_table tr { height: 33px; padding: 2px 2px 0; text-align: center; line-height: 33px; border: 1px solid #bdbebd; } </style>
<div class="counter_div"> <table class="counter_table"> <thead> <tr> <th>¿µ»ó¸í</th> <th>Ä«¿îÆ®</th> </tr> </thead> <tbody>
<?php while($info = mysql_fetch_array($res)) { ?>
<tr> <td><?php echo $info['page_kr']; ?></td> <td><?php echo $info['cnt']; ?></td> </tr>
<?php } ?>
</tbody> </table> <p>¡Ø ¸®½ºÆ®¿¡ ¾ø´Â ¿µ»óµéÀº Ä«¿îÆ®°¡ 0ÀÔ´Ï´Ù.</p> </div>
<?php } else {
$sql = "SELECT inflow_time, count FROM mBoard_page_count WHERE inflow_date BETWEEN '{$txtdate}' AND '{$txtdate2}' AND PAGE = '{$page}' ORDER BY inflow_time ASC"; $res = mysql_query($sql,$connect_web); if(!$res) { echo "µ¥ÀÌÅÍ Ãëµæ¿¡ ½ÇÆÐÇß½À´Ï´Ù. <br>".mysql_error(); } while($info = mysql_fetch_array($res)) { $cnt_array[] = $info; }
//var_dump($cnt_array);
$time_array[] = "00:00 ~ 01:00"; $time_array[] = "01:00 ~ 02:00"; $time_array[] = "02:00 ~ 03:00"; $time_array[] = "03:00 ~ 04:00"; $time_array[] = "04:00 ~ 05:00"; $time_array[] = "05:00 ~ 06:00"; $time_array[] = "06:00 ~ 07:00"; $time_array[] = "07:00 ~ 08:00"; $time_array[] = "08:00 ~ 09:00"; $time_array[] = "09:00 ~ 10:00"; $time_array[] = "10:00 ~ 11:00"; $time_array[] = "11:00 ~ 12:00"; $time_array[] = "12:00 ~ 13:00"; $time_array[] = "13:00 ~ 14:00"; $time_array[] = "14:00 ~ 15:00"; $time_array[] = "15:00 ~ 16:00"; $time_array[] = "16:00 ~ 17:00"; $time_array[] = "17:00 ~ 18:00"; $time_array[] = "18:00 ~ 19:00"; $time_array[] = "19:00 ~ 20:00"; $time_array[] = "20:00 ~ 21:00"; $time_array[] = "21:00 ~ 22:00"; $time_array[] = "22:00 ~ 23:00"; $time_array[] = "23:00 ~ 24:00";
?>
<style> table { border-collapse: collapse; border-spacing: 0; border: 0 none; } .counter_table th { width: 195px; } .counter_table th, .counter_table td, .counter_table tr { height: 33px; padding: 2px 2px 0; text-align: center; line-height: 33px; border: 1px solid #bdbebd; } </style>
<div class="counter_div"> <table class="counter_table"> <thead> <tr> <th>½Ã°£´ë</th> <th>Ä«¿îÆ®</th> </tr> </thead> <tbody>
<?php for($i = 0; $i < count($time_array); $i++) { // ½Ã°£´ë(00:00 ~ 24:00)¸¦ µ¹¸² $t1 = $time_array[$i]; // ½Ã°£´ë »Ì¾Æ³»±â $t1 = (int)substr($t1,0,2); // ¾ÕÀÚ¸®¸¸ »Ì¾Æ³»±â(00~24)
for($j = 0; $j < count($cnt_array); $j++) { // Ä«¿îÆ® µ¥ÀÌÅÍ µ¹¸®±â $info = $cnt_array[$j]; // µ¥ÀÌÅÍ »Ì¾Æ³»±â $count = ""; // º¯¼öÃʱâÈ
if($t1 != (int)$info['inflow_time']) { // »Ì¾Æ³½ ½Ã°£´ë¿Í Ä«¿îÆ®µ¥ÀÌÅÍÀÇ ½Ã°£ÀÌ ¸ÂÁö¾ÊÀ¸¸é $count = "0"; // 0 } else { // ½Ã°£ÀÌ ¸ÂÀ¸¸é $count = number_format($info['count']); // Ä«¿îÆ®µ¥ÀÌÅ͸¦ »Ì¾Æ¿È break 1; // ±×¸®°í for¹® Å»Ãâ } } ?>
<tr> <td><?php echo $time_array[$i]; ?></td> <td><?php echo $count; ?></td> </tr>
<?php } ?>
</tbody> </table> </div>
<?php } //if flg=movie else ?>
|