質問編集履歴

2

コード

2017/08/22 17:17

投稿

sakanakuuuuunn
sakanakuuuuunn

スコア14

test CHANGED
File without changes
test CHANGED
@@ -25,8 +25,6 @@
25
25
  ```php
26
26
 
27
27
 
28
-
29
- 実際は上記にはSELECT文の記載があります。
30
28
 
31
29
  for($i = 0; $i < count($user_id_name); $i++){
32
30
 

1

コードを変更しました

2017/08/22 17:17

投稿

sakanakuuuuunn
sakanakuuuuunn

スコア14

test CHANGED
File without changes
test CHANGED
@@ -28,21 +28,35 @@
28
28
 
29
29
  実際は上記にはSELECT文の記載があります。
30
30
 
31
- $userData = array();
31
+ for($i = 0; $i < count($user_id_name); $i++){
32
32
 
33
- while($result = $stmt->fetch(PDO::FETCH_ASSOC)){
33
+ $sql =" 〜 ";
34
34
 
35
+
36
+
37
+ $stmt = $pdo -> query($sql);
38
+
39
+ $stmt->execute();
40
+
41
+
42
+
43
+ $userData = array();
44
+
45
+ while($result = $stmt->fetch(PDO::FETCH_ASSOC)){
46
+
35
- $userData[]=array(
47
+ $userData[]=array(
36
48
 
37
49
  'name' => $result['user_name'],
38
50
 
39
51
  'time' => $result['user_time']
40
52
 
41
- );
53
+ );
42
54
 
43
- }
55
+ }
44
56
 
45
- $jsonTest=json_encode($userData,JSON_UNESCAPED_UNICODE);
57
+ $jsonTest=json_encode($userData,JSON_UNESCAPED_UNICODE);
58
+
59
+ print_r($jsonTest);
46
60
 
47
61
  }
48
62
 
@@ -50,11 +64,77 @@
50
64
 
51
65
  ```javascript
52
66
 
67
+ $view = <<<EOD
68
+
69
+
70
+
71
+ <!DOCTYPE html>
72
+
73
+ <html lang="ja">
74
+
75
+ <head>
76
+
77
+ <meta charset="UTF-8">
78
+
79
+ <title>sample</title>
80
+
81
+ <script type = "text/javascript" src="jquery-3.2.1.min.js"></script>
82
+
53
83
  <script type="text/javascript">
54
84
 
55
85
  var test=JSON.parse('<?php echo $jsonTest; ?>');
56
86
 
87
+ ------プラグイン---------------
88
+
89
+ jQuery( function() {
90
+
91
+
92
+
93
+ jQuery . jqplot(
94
+
95
+ 'jqPlot-sample',
96
+
97
+ [
98
+
99
+ test
100
+
101
+ ],
102
+
103
+ {
104
+
105
+ seriesDefaults: {
106
+
107
+ renderer: jQuery . jqplot . BarRenderer,
108
+
109
+ rendererOptions: {
110
+
111
+ barDirection: 'horizontal'
112
+
113
+ }
114
+
115
+ },
116
+
117
+ axes: {
118
+
119
+ yaxis: {
120
+
121
+ renderer: jQuery . jqplot . CategoryAxisRenderer,
122
+
123
+ }
124
+
125
+ }
126
+
127
+ }
128
+
129
+ );
130
+
131
+ } );
132
+
133
+ ------------------
134
+
57
135
  </script>
136
+
137
+ <body>
58
138
 
59
139
  ```
60
140