回答編集履歴
1
改善したコードを更新します。
test
CHANGED
@@ -1 +1,49 @@
|
|
1
|
+
以下のようにsaerch.phpの検索結果のプログラムを改善しました。
|
2
|
+
|
3
|
+
```php
|
4
|
+
|
1
|
-
|
5
|
+
//search.php
|
6
|
+
|
7
|
+
//検索結果
|
8
|
+
|
9
|
+
if (!isset($_SESSION['search'])) {
|
10
|
+
|
11
|
+
header('Location: index.php');
|
12
|
+
|
13
|
+
exit();
|
14
|
+
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
if (!empty($_SESSION['search'])) {
|
20
|
+
|
21
|
+
$groups = $db->prepare("SELECT * FROM groups WHERE area LIKE ? OR genre LIKE ? OR belong LIKE ?");
|
22
|
+
|
23
|
+
$area = "%".$_SESSION['search']['area']."%";
|
24
|
+
|
25
|
+
$genre = "%".$_SESSION['search']['genre']."%";
|
26
|
+
|
27
|
+
$belong = "%".$_SESSION['search']['belong']."%";
|
28
|
+
|
29
|
+
// $groups->bindParam(1, $start, PDO::PARAM_INT);
|
30
|
+
|
31
|
+
// ORDER BY created DESC LIMIT ?, 5
|
32
|
+
|
33
|
+
$groups->execute(array(
|
34
|
+
|
35
|
+
$area,
|
36
|
+
|
37
|
+
$genre,
|
38
|
+
|
39
|
+
$belong
|
40
|
+
|
41
|
+
));
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
unset($_SESSION['search']);
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
```
|