質問編集履歴

5

変更内容

2020/01/20 02:17

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -170,9 +170,9 @@
170
170
 
171
171
 
172
172
 
173
-   $username = "gay86_saikio4706";
173
+   $username = "asasdasdasd";
174
-
174
+
175
-   $password = "nfgwe4706";
175
+   $password = "safsadfasdfdsaf";
176
176
 
177
177
 
178
178
 

4

変更内容

2020/01/20 02:17

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -170,41 +170,41 @@
170
170
 
171
171
 
172
172
 
173
- $username = "gay86_saikio4706";
173
+   $username = "gay86_saikio4706";
174
-
174
+
175
- $password = "nfgwe4706";
175
+   $password = "nfgwe4706";
176
-
177
-
178
-
176
+
177
+
178
+
179
- $pdo = new PDO("mysql:host=mysql8093.xserver.jp; dbname=gay86_roundcubemail; charset=utf8", $username, $password);
179
+   $pdo = new PDO("mysql:host=mysql8093.xserver.jp; dbname=gay86_roundcubemail; charset=utf8", $username,   $password);
180
-
181
-
182
-
180
+
181
+
182
+
183
- $sql = "select username, hold_position from uploaders";
183
+   $sql = "select username, hold_position from uploaders";
184
-
184
+
185
- $stmt = $pdo->prepare($sql);
185
+   $stmt = $pdo->prepare($sql);
186
-
186
+
187
- $stmt->execute();
187
+   $stmt->execute();
188
-
189
-
190
-
188
+
189
+
190
+
191
- header("Content-Type: application/json; charset=utf-8");
191
+   header("Content-Type: application/json; charset=utf-8");
192
-
193
-
194
-
192
+
193
+
194
+
195
- echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
195
+   echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
196
-
197
-
198
-
196
+
197
+
198
+
199
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
199
+   $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
200
200
 
201
201
 
202
202
 
203
203
  }catch(PDOException $e){
204
204
 
205
- echo "接続失敗: " . $e->getMessage() . "\n";
205
+   echo "接続失敗: " . $e->getMessage() . "\n";
206
-
206
+
207
- exit();
207
+   exit();
208
208
 
209
209
  }
210
210
 

3

変更内容

2020/01/20 02:12

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -157,3 +157,59 @@
157
157
  {"hold_position":"sasdfsdfasdfadsfads","username":"ksdfjsdlfjsdkfjal"}
158
158
 
159
159
  ```
160
+
161
+ (修正後)
162
+
163
+
164
+
165
+ ```
166
+
167
+ <?php
168
+
169
+ try{
170
+
171
+
172
+
173
+ $username = "gay86_saikio4706";
174
+
175
+ $password = "nfgwe4706";
176
+
177
+
178
+
179
+ $pdo = new PDO("mysql:host=mysql8093.xserver.jp; dbname=gay86_roundcubemail; charset=utf8", $username, $password);
180
+
181
+
182
+
183
+ $sql = "select username, hold_position from uploaders";
184
+
185
+ $stmt = $pdo->prepare($sql);
186
+
187
+ $stmt->execute();
188
+
189
+
190
+
191
+ header("Content-Type: application/json; charset=utf-8");
192
+
193
+
194
+
195
+ echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
196
+
197
+
198
+
199
+ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
200
+
201
+
202
+
203
+ }catch(PDOException $e){
204
+
205
+ echo "接続失敗: " . $e->getMessage() . "\n";
206
+
207
+ exit();
208
+
209
+ }
210
+
211
+
212
+
213
+ ?>
214
+
215
+ ```

2

変更内容

2020/01/20 02:11

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -38,45 +38,43 @@
38
38
 
39
39
 
40
40
 
41
- $pdo = new PDO("mysql:host={hostname}; dbname={dbname}; charset=utf8", $username, $password);
41
+ $pdo = new PDO("mysql:host={hostname}; dbname={dbname}; charset=utf8", $username, $password);
42
42
 
43
43
 
44
44
 
45
- $sql = "select username, hold_position from uploaders";
45
+ $sql = "select username, hold_position from uploaders";
46
46
 
47
- $stmt = $pdo->prepare($sql);
47
+ $stmt = $pdo->prepare($sql);
48
48
 
49
- $stmt->execute();
49
+ $stmt->execute();
50
50
 
51
51
 
52
52
 
53
53
 
54
54
 
55
- while($result = $stmt->fetchAll(PDO::FETCH_ASSOC)){
55
+ while($result = $stmt->fetchAll(PDO::FETCH_ASSOC)){
56
56
 
57
57
 
58
58
 
59
- if(!empty($result)){
59
+ if(!empty($result)){
60
60
 
61
- $message[] = $result;
61
+ $message[] = $result;
62
62
 
63
- }
63
+ }
64
+
65
+ }
64
66
 
65
67
 
66
68
 
67
- }
68
-
69
-
70
-
71
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
69
+ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
72
70
 
73
71
 
74
72
 
75
73
  }catch(PDOException $e){
76
74
 
77
- echo "接続失敗: " . $e->getMessage() . "\n";
75
+ echo "接続失敗: " . $e->getMessage() . "\n";
78
76
 
79
- exit();
77
+ exit();
80
78
 
81
79
  }
82
80
 
@@ -88,27 +86,17 @@
88
86
 
89
87
  foreach($message as $value){
90
88
 
89
+ foreach($value as $key => $value2){
91
90
 
91
+ $ehime = $value2["username"];
92
92
 
93
- foreach($value as $key => $value2){
93
+ $ehime2 = $value2["hold_position"];
94
94
 
95
+ $nitta[] = $ehime;
95
96
 
97
+ $nitta[] = $ehime2;
96
98
 
97
- $ehime = $value2["username"];
98
-
99
- $ehime2 = $value2["hold_position"];
100
-
101
-
102
-
103
- $nitta[] = $ehime;
104
-
105
- $nitta[] = $ehime2;
106
-
107
-
108
-
109
- }
99
+ }
110
-
111
-
112
100
 
113
101
  }
114
102
 
@@ -134,23 +122,21 @@
134
122
 
135
123
  <script language="javascript" type="text/javascript">
136
124
 
137
- var request = new XMLHttpRequest();
125
+ var request = new XMLHttpRequest();
138
126
 
139
- request.open('GET', 'http://sssss.xsrv.jp/ssss6/public/roundcube/skins/elastic/deps/tester2.php',true);
127
+ request.open('GET', 'http://sssss.xsrv.jp/ssss6/public/roundcube/skins/elastic/deps/tester2.php',true);
140
128
 
141
- request.resposeType = 'json';
129
+ request.resposeType = 'json';
142
130
 
143
- request.addEventListener('load', function(response){
131
+ request.addEventListener('load', function(response){
144
132
 
133
+ var data = this.response;
145
134
 
135
+ alert(data);
146
136
 
147
- var data = this.response;
137
+ });
148
138
 
149
- alert(data);
150
-
151
- });
152
-
153
- request.send();
139
+ request.send();
154
140
 
155
141
  </script>
156
142
 

1

変更内容

2020/01/20 01:35

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -146,13 +146,7 @@
146
146
 
147
147
  var data = this.response;
148
148
 
149
-
150
-
151
149
  alert(data);
152
-
153
- document.getElementById("Nitta").innerHTML = '<a href="#">' + get_data + '</a><img src="' + get_data2 + '">';
154
-
155
-
156
150
 
157
151
  });
158
152