質問編集履歴
2
脱字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
$result = $sth->fetch(PDO::FETCH_ASSOC);
|
23
23
|
return $result;
|
24
24
|
}
|
25
|
+
}
|
25
26
|
|
26
27
|
class PlayerController {
|
27
28
|
private $request;//リクエストパラメータ(GET,POST)
|
@@ -52,5 +53,5 @@
|
|
52
53
|
];
|
53
54
|
return $parmas;
|
54
55
|
}
|
56
|
+
}
|
55
57
|
|
56
|
-
|
1
class追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,6 +7,12 @@
|
|
7
7
|
|
8
8
|
```php
|
9
9
|
//メソッド部分//
|
10
|
+
class Player extends Db {
|
11
|
+
private $table = 'players';
|
12
|
+
|
13
|
+
public function __construct($dbh = null) {
|
14
|
+
parent::__construct($dbh);
|
15
|
+
}
|
10
16
|
public function findById($id = 0):Array {
|
11
17
|
$sql = 'SELECT * FROM '.$this->table;
|
12
18
|
$sql .= ' WHERE id = :id';
|
@@ -16,6 +22,15 @@
|
|
16
22
|
$result = $sth->fetch(PDO::FETCH_ASSOC);
|
17
23
|
return $result;
|
18
24
|
}
|
25
|
+
|
26
|
+
class PlayerController {
|
27
|
+
private $request;//リクエストパラメータ(GET,POST)
|
28
|
+
private $Player;//Playerモデル
|
29
|
+
|
30
|
+
public function __construct() {
|
31
|
+
//リクエストパラメータの取得
|
32
|
+
$this->request['get'] = $_GET;
|
33
|
+
$this->request['post'] = $_POST;
|
19
34
|
|
20
35
|
public function index() {
|
21
36
|
$players = $this->Player->findAll(); //←エラー箇所
|