回答編集履歴
1
調整
test
CHANGED
@@ -2,3 +2,17 @@
|
|
2
2
|
update testtable set (title
|
3
3
|
````
|
4
4
|
setの後ろにカッコをつけるのはおかしいですね
|
5
|
+
|
6
|
+
# 追記
|
7
|
+
```PHP
|
8
|
+
$id =filter_input(INPUT_POST,"id");
|
9
|
+
$title =filter_input(INPUT_POST,"title");
|
10
|
+
$body =filter_input(INPUT_POST,"body");
|
11
|
+
$sql = "update testtable set title = ?, body = ?, updated_at = now() where id = ?";
|
12
|
+
$stmt = $dbh->prepare($sql);
|
13
|
+
$stmt->execute([$title,$body,$id]);
|
14
|
+
$sql "select title, body from testtable where id = ?";
|
15
|
+
$stmt = $dbh->prepare($sql);
|
16
|
+
$stmt->execute([$id]);
|
17
|
+
$rows=$stmt->fetchAll(PDO::FETCH_ASSOC);
|
18
|
+
```
|