ある登録ページを作っていて、ページ遷移するときに下記のようなエラーがでてしまいます。
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.userdata' doesn't exist' in C:\xampp\htdocs\xxx\lib\class\check\Validate.php:48 Stack trace: #0
C:\xampp\htdocs\xxx\lib\class\check\Validate.php(48): PDOStatement->execute(Array) #1 C:\xampp\htdocs\xxx\register_human_en.php(6): Validate->isRegisterd() #2 {main} thrown in C:\xampp\htdocs\xxx\lib\class\check\Validate.php on line 48
昨日まではこんなエラー出ずにちゃんとページ遷移できていたんですが、、、
どういう意味なのでしょうか?
一応ソース載せておきます。
宜しくお願いします。
<?php class Validate{ private $error = array(); public function isEqualEmail(){ if (is_null(filter_input_array(INPUT_POST))) { return $this; } $email = filter_input(INPUT_POST, 'email'); $email_conf = filter_input(INPUT_POST, 'email_conf'); if ($email !== $email_conf) { $this->error['email'] = '<div class="errorMessage">' . "メールアドレスが一致しません" . '</div>'; } return $this; } public function isEqualPassword(){ if (is_null(filter_input_array(INPUT_POST))) { return $this; } $pw = filter_input(INPUT_POST, 'pw'); $pw_conf = filter_input(INPUT_POST, 'pw_conf'); if ($pw !== $pw_conf) { $this->error['password'] = '<div class="errorMessage">' . "パスワードが一致しません" . '</div>'; } return $this; } public function isRegisterd(){ if (is_null(filter_input_array(INPUT_POST))) { return $this; } $email = filter_input(INPUT_POST, 'email'); $dsn = 'mysql:dbname=test;host=localhost;charset=utf8'; $user = 'root'; $password = ''; $option = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $dbh = new PDO($dsn, $user, $password, $option); $sql = 'select count(*) as cnt from userdata where email=?'; $stmt = $dbh->prepare($sql); $arrParam = array(); $arrParam[] = $email; $stmt->execute($arrParam); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (0 < $row['cnt']) { $this->error['email_registered'] = '<div class="errorMessage">' . "{$email}は既に登録されています" . '</div>'; } return $this; } public function check(){ if (count($this->error)) { return false; } return true; } public function getErrorMessage(){ return $this->error; } } ?>
48行目は
$stmt->execute($arrParam);
です。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/06/20 02:17