質問編集履歴

2

追記

2016/06/30 14:21

投稿

earnest_gay
earnest_gay

スコア615

test CHANGED
File without changes
test CHANGED
@@ -61,3 +61,69 @@
61
61
 
62
62
 
63
63
  と最後で一括更新させる構造になっています。
64
+
65
+
66
+
67
+ ---
68
+
69
+
70
+
71
+ ログインしている人のidはまだ確立していませんが、仮の数字を入れてテストすることでこれでいけました。
72
+
73
+
74
+
75
+ ```ここに言語を入力
76
+
77
+ public function isRegisterd(){
78
+
79
+ if (is_null(filter_input_array(INPUT_POST))) {
80
+
81
+ return $this;
82
+
83
+ }
84
+
85
+
86
+
87
+ $email = filter_input(INPUT_POST, 'email');
88
+
89
+
90
+
91
+ $dsn = 'mysql:dbname=test;host=localhost;charset=utf8';
92
+
93
+ $user = 'root';
94
+
95
+ $password = '';
96
+
97
+ $option = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
98
+
99
+ $pdo = new PDO($dsn, $user, $password, $option);
100
+
101
+
102
+
103
+ $sql = 'SELECT count(*) AS cnt FROM user_data WHERE email=? AND id != ログインしてる人のid';
104
+
105
+ $stmt = $pdo->prepare($sql);
106
+
107
+
108
+
109
+ $arrParam = array();
110
+
111
+ $arrParam[] = $email;
112
+
113
+ $stmt->execute($arrParam);
114
+
115
+
116
+
117
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
118
+
119
+ if (0 < $row['cnt']) {
120
+
121
+ $this->error['email_registered'] = '<div class="errorMessage">' . "{$email}は既に登録されています" . '</div>';
122
+
123
+ }
124
+
125
+ return $this;
126
+
127
+ }
128
+
129
+ ```

1

追記

2016/06/30 14:21

投稿

earnest_gay
earnest_gay

スコア615

test CHANGED
File without changes
test CHANGED
@@ -43,3 +43,21 @@
43
43
  }
44
44
 
45
45
  ```
46
+
47
+
48
+
49
+ 参考にですが
50
+
51
+
52
+
53
+ input1.php
54
+
55
+ input2.php
56
+
57
+ preview.php
58
+
59
+ thanks.php
60
+
61
+
62
+
63
+ と最後で一括更新させる構造になっています。