質問編集履歴

1

追記

2019/02/09 18:07

投稿

Chandler_Bing
Chandler_Bing

スコア673

test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,35 @@
47
47
 
48
48
 
49
49
  となります。間違いを教えてください
50
+
51
+
52
+
53
+ 変数で入力するとあった為、
54
+
55
+ ```PHP
56
+
57
+ public function searchhotels($word)
58
+
59
+ {
60
+
61
+ $sql = "select hotel_id, country_code from areas where area like ?";
62
+
63
+ $searchword = "'%{$word}%'";
64
+
65
+ $stmt = $this->db->prepare($sql);
66
+
67
+ $stmt->bindParam(1, $searchword, PDO::PARAM_STR);
68
+
69
+ // $stmt->bindValue(1, "'%{$word}%'", PDO::PARAM_STR);
70
+
71
+ $stmt->execute();
72
+
73
+ }
74
+
75
+
76
+
77
+ ```
78
+
79
+
80
+
81
+ のように変更しましたが、NULLが返ってきます。