質問編集履歴
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,6 +18,30 @@
|
|
18
18
|
|
19
19
|
$stmt->execute();
|
20
20
|
|
21
|
+
|
22
|
+
|
23
|
+
while($rec = $stmt->fetch(PDO::FETCH_ASSOC)){
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
// テーブルの項目名を指定して値を表示
|
28
|
+
|
29
|
+
$hoge = ($rec['hoge']);
|
30
|
+
|
31
|
+
$hogehoge = ($rec['hogehoge']);
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
?>
|
36
|
+
|
37
|
+
<?php echo $hoge;?>
|
38
|
+
|
39
|
+
<?php echo $hogehoge;?>
|
40
|
+
|
41
|
+
<?php
|
42
|
+
|
43
|
+
}
|
44
|
+
|
21
45
|
```
|
22
46
|
|
23
47
|
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,13 +4,19 @@
|
|
4
4
|
|
5
5
|
```ここに言語を入力
|
6
6
|
|
7
|
-
$a = $_POST["select"];
|
7
|
+
$a = $_POST["select"]; //<select name="a">
|
8
8
|
|
9
|
-
$b = $_POST["text"];
|
9
|
+
$b = $_POST["text"]; //<input name="b" type="text">
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
$stmt = $pdo->prepare("SELECT * FROM `item` WHERE `key` = :key1 OR `key` = :key2");
|
10
14
|
|
11
15
|
$stmt->bindParam(':key1', $a); //selectタイプはOK
|
12
16
|
|
13
17
|
$stmt->bindParam(':key2', $b ); //textがNG
|
18
|
+
|
19
|
+
$stmt->execute();
|
14
20
|
|
15
21
|
```
|
16
22
|
|