回答編集履歴

2

追記

2016/07/05 06:33

投稿

退会済みユーザー
test CHANGED
@@ -47,3 +47,11 @@
47
47
  }
48
48
 
49
49
  ```
50
+
51
+
52
+
53
+ ![イメージ説明](07f3c0c2bf19d114f9e4922fcf0e0a8e.png)
54
+
55
+
56
+
57
+ `$list_data`(赤枠) が関数ブロック(青枠)のなかで、値がセットされていません。なんのための return ?

1

修正

2016/07/05 06:33

投稿

退会済みユーザー
test CHANGED
@@ -3,3 +3,47 @@
3
3
 
4
4
 
5
5
  ハイライト表示がおかしくなっているところが間違っています。
6
+
7
+
8
+
9
+ ---
10
+
11
+
12
+
13
+ ```php
14
+
15
+ if(filter_input(INPUT_POST,'btn')==='register')
16
+
17
+ $sql = 'INSERT INTO kadai1 ("name", "comment") VALUES (NULL, "名前")(NULL, "内容")'; // <-SQLに間違い。シンタックスエラーにはならないけど、実行したらエラーになるでしょう。
18
+
19
+ $sth = $dbh->prepare($sql);
20
+
21
+ $sth->bindparam(':name', $_POST['name'], PDO::PARAM_STR);
22
+
23
+ $sth->bindparam(':comment', $_POST['comment'], PDO::PARAM_STR);
24
+
25
+ $sth->execute();
26
+
27
+
28
+
29
+ echo htmlspecialchars($_POST['name'], ENT_QUOTES, 'UTF-8');
30
+
31
+ echo htmlspecialchars($_POST['comment'], ENT_QUOTES, 'UTF-8');
32
+
33
+
34
+
35
+ var_dump($_POST) //  <ーセミコロンない
36
+
37
+
38
+
39
+ $list_data = dbAccess();{ // <-このカッコはif の後ろじゃない?
40
+
41
+
42
+
43
+ $now = date('Y/m/d H:i:s');
44
+
45
+
46
+
47
+ }
48
+
49
+ ```