teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

修正

2020/11/17 05:39

投稿

ayuayuayu
ayuayuayu

スコア68

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,5 @@
1
1
  ```ここに言語を入力
2
- <?php
3
- ini_set('display_errors', 0);
2
+ <?phpini_set('display_errors', 0);
4
3
 
5
4
 
6
5
  if(isset($_POST['confirm'])){
@@ -9,48 +8,7 @@
9
8
  $where = $_POST['where'];
10
9
 
11
10
 
12
-
13
- try{
14
- $pdo = new PDO("mysql:host=localhost;dbname=〇〇;charset=utf8;","root","");
15
- $pdo ->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
16
- $sql = "UPDATE 〇 SET confirm = :confirm WHERE no = :no";
17
- $stmt_c = $pdo->prepare($sql);
18
- $stmt_c->bindvalue(':no', $no, PDO::PARAM_STR);
19
- $stmt_c->bindvalue(':confirm', $confirm, PDO::PARAM_STR);
20
- $stmt_c ->execute();
21
11
 
22
- } catch (Exception $e){
23
- exit('データベース接続失敗。' . $e ->getMessage());
24
- }
25
-
26
-
27
- }
28
-
29
-
30
- $where = [];
31
- if(isset($_POST['site']) && $_POST['site'] != ""){
32
- $where[] = "( site = '" . $_POST['site']."')";
33
- $site = $_POST['site'];
34
- }
35
-
36
- if(isset($_POST['message']) && $_POST['message'] != ""){
37
- $where[] = "( message = '" . $_POST['message']."')";
38
- $message = $_POST['message'];
39
- }
40
-
41
- if(isset($_POST['nichi']) && $_POST['nichi'] != ""){
42
- $where[] = "( nichi = '" . $_POST['nichi']."')";
43
- $nichi = $_POST['nichi'];
44
- }
45
-
46
- if(isset($_POST['name']) && $_POST['name'] != ""){
47
- $where[] = "( name = '" . $_POST['name']."')";
48
- $name = $_POST['name'];
49
- }
50
-
51
-
52
- $line = "ORDER BY no DESC";
53
-
54
12
 
55
13
  try{
56
14
  $pdo = new PDO("mysql:host=localhost;dbname=〇〇;charset=utf8;","root","");
@@ -74,16 +32,7 @@
74
32
 
75
33
  ?>
76
34
 
77
- <!DOCTYPE html>
78
- <html lang="jp">
79
35
 
80
- <head>
81
- <meta charset="UTF-8">
82
- <meta name="viewport" content="width=890">
83
- <link rel="stylesheet" href="1113.css">
84
- </head>
85
- <body>
86
-
87
36
  <p class="search">検索条件=> ユーザーID:<?=$name?> /サイト名:<?=$site?> /誕生日: <?=$message?> /入力日時: <?=$nichi?><br><a href="./cms2.php"><<<戻る</a></p>
88
37
  <table border=1>
89
38
  <tr><th>no</th><th>ユーザー名</th><th>誕生日</th><th>入力日時</th><th>サイト名</th><th colspan="2">確認</th></tr>
@@ -137,8 +86,6 @@
137
86
  }
138
87
  ?>
139
88
 
140
- </body>
141
- </html>
142
89
  ```
143
90
 
144
91
  更新ボタンを押したら内容が全て消えてしまいます。