質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -49,5 +49,5 @@
|
|
49
49
|
|
50
50
|
$t_colorに値が入っている時
|
51
51
|
```
|
52
|
-
Fatal error: Uncaught Error: Call to a member function
|
52
|
+
Fatal error: Uncaught Error: Call to a member function fetch_all() on bool in
|
53
53
|
```
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,11 +27,27 @@
|
|
27
27
|
?>
|
28
28
|
```
|
29
29
|
|
30
|
-
###
|
30
|
+
### 変更後
|
31
|
+
```PHP
|
32
|
+
$sql = "SELECT * FROM it where kind like 'トップス'" ;
|
33
|
+
if(empty($t_color)){
|
34
|
+
$stmt = $dbh->query($sql);
|
35
|
+
}
|
36
|
+
else{
|
37
|
+
$sql.="and where color like '$t_color'";
|
38
|
+
$stmt = $dbh->query($sql);
|
39
|
+
}
|
40
|
+
$rows=$stmt->fetch_all(MYSQLI_ASSOC);
|
41
|
+
print_r($rows);
|
42
|
+
```
|
31
43
|
|
32
|
-
|
44
|
+
[結果]
|
45
|
+
$t_colorが空の時
|
46
|
+
```
|
47
|
+
Array ( [0] => Array ( [meisho] => トップス1 [season] => 春 [kind] => トップス [tops] => ニット [botom] => [auter] => [onep] => [inone] => [color] => 白 [nagasa] => ミドル [sode] => 十分丈 [gara] => 無地 ) [1] => Array ( [meisho] => トップス2 [season] => 夏 [kind] => トップス [tops] => Tシャツ [botom] => [auter] => [onep] => [inone] => [color] => 青 [nagasa] => ミドル [sode] => 半袖 [gara] => プリント ) [2] => Array ( [meisho] => トップス3 [season] => 秋 冬 [kind] => トップス [tops] => カーディガン [botom] => [auter] => [onep] => [inone] => [color] => 黄色 [nagasa] => ミドル [sode] => 十分丈 [gara] => 無地 ) )
|
48
|
+
```
|
33
49
|
|
34
|
-
### 補足情報(FW/ツールのバージョンなど)
|
35
|
-
|
36
|
-
|
50
|
+
$t_colorに値が入っている時
|
37
|
-
|
51
|
+
```
|
52
|
+
Fatal error: Uncaught Error: Call to a member function bind_param() on bool in
|
53
|
+
```
|