-1
我正在做一個登錄和註冊系統,使用PDO的數據庫連接。當我想檢查用戶名則返回默認的錯誤:註冊總是給我默認錯誤
Sorry, that username is already taken. Please choose another one.
即使我只是打字hduigifugfulgfrfg
它總是給我的錯誤:/
我的代碼:
} else if ($this->databaseConnection()) {
$query_check_user_name = $this->db_connection->prepare('SELECT user_name, user_email FROM users WHERE user_name=:user_name OR user_email=:user_email');
$query_check_user_name->bindValue(':user_name', $user_name, PDO::PARAM_STR);
$query_check_user_name->bindValue(':user_email', $user_email, PDO::PARAM_STR);
$query_check_user_name->execute();
$result = $query_check_user_name->fetchAll();
if (count($result) > 0) {
for ($i = 0; $i < count($result); $i++) {
$this->errors[] = ($result[$i]['user_name'] == $user_name) ? MESSAGE_USERNAME_EXISTS : MESSAGE_EMAIL_ALREADY_EXISTS;
}
不任何人看到一個錯誤或什麼?我正在尋找一個這麼久,我什麼都看不到了:P
謝謝。