質問編集履歴
4
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
##問題
|
10
10
|
以下のようにコードを記述しましたが、エラーが表示されてしまう。
|
11
|
-

|
12
12
|
PlayerController
|
13
13
|
```
|
14
14
|
<?php
|
@@ -68,13 +68,12 @@
|
|
68
68
|
}
|
69
69
|
|
70
70
|
public function findById($id = 0):Array {
|
71
|
-
$sql = 'SELECT * FROM'.$this->table;
|
72
|
-
$sql
|
71
|
+
$sql = 'SELECT * FROM WHERE id = :id';
|
73
72
|
$sth = $this->dbh->prepare($sql);
|
74
73
|
$sth->bindParam(':id', $id, PDO::PARAM_INT);
|
75
74
|
$sth->execute();
|
76
75
|
$result = $sth->fetch(PDO::FETCH_ASSOC);
|
77
|
-
return $result;
|
76
|
+
return $result;
|
78
77
|
}
|
79
78
|
}
|
80
79
|
```
|
@@ -156,9 +155,9 @@
|
|
156
155
|
<th>身長</th>
|
157
156
|
<th>体重</th>
|
158
157
|
</tr>
|
159
|
-
<?php foreach($params['players'] as $player): ?>←
|
158
|
+
<?php foreach($params['players'] as $player): ?>←31行目
|
160
159
|
<tr>
|
161
|
-
<th><?=$player['id'] ?></th>
|
160
|
+
<th><?=$player['id'] ?></th>←33行目
|
162
161
|
<th><?=$player['uniform_num'] ?></th>
|
163
162
|
<th><?=$player['position'] ?></th>
|
164
163
|
<th><?=$player['name'] ?></th>
|
@@ -173,5 +172,4 @@
|
|
173
172
|
</html>
|
174
173
|
```
|
175
174
|
|
176
|
-
追記
|
177
|
-
|
175
|
+
var_dumpで$paramsを調べると全てstring型になっているのが原因?
|
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -156,7 +156,7 @@
|
|
156
156
|
<th>身長</th>
|
157
157
|
<th>体重</th>
|
158
158
|
</tr>
|
159
|
-
<?php foreach($params['players'] as $player): ?>
|
159
|
+
<?php foreach($params['players'] as $player): ?>←30行目
|
160
160
|
<tr>
|
161
161
|
<th><?=$player['id'] ?></th>
|
162
162
|
<th><?=$player['uniform_num'] ?></th>
|
@@ -171,4 +171,7 @@
|
|
171
171
|
</table>
|
172
172
|
</body>
|
173
173
|
</html>
|
174
|
-
```
|
174
|
+
```
|
175
|
+
|
176
|
+
追記
|
177
|
+

|
2
タイトルの変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
idごとのデータ詳細を表示させたい
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
##解決したいこと
|
2
|
-
|
2
|
+
データベースのidごとのデータ詳細を表示させたいです。
|
3
3
|
※データの一覧やデータベースの接続などは実装できています。
|
4
4
|
|
5
5
|
データの一覧
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|