데이터베이스에 나열된 전자 메일 주소와 전자 메일 주소가 일치하지 않는지 확인하려고합니다.데이터베이스에 전자 메일이 이미 있는지 확인하려고 시도합니다.
내가 이해 한 rowCount
을 사용하려고 시도했는데 일치 항목을 찾았는지에 부울 true
또는 false
을 반환합니다.
그러나 이메일 주소는 여전히 데이터베이스에 입력됩니다. 나는이가 내 전화 프로그램에서 다음
public function checkEmail(){
if($this->post_data['reg_email'] == $this->post_data['reg_conf_email']){
if(filter_var($this->post_data['reg_email'], FILTER_VALIDATE_EMAIL)){
$stmt = $this->dbh->prepare("SELECT email FROM oopforum_users WHERE email = ?");
$stmt->bindParam(1, $this->post_data['reg_email'], PDO::PARAM_STR);
$stmt->execute();
$result = $stmt->rowCount();
if($this->result){
return true;
}else{
return false;
}
}else{
return false;
}
}else{
return false;
}
}
: 여기
내가 이메일을 확인하기 위해 사용하고하는 방법입니다if($register->checkUsername()){
if(!$register->checkEmail()){
//continue...
}else{
$message = 'ERROR: That email is not valid, doesn\'t match the confirmation email or already exists on our database, please choose another one.';
}
}else{
$message = 'ERROR: That username is invalid or is already taken, please choose another one and ensure it is atleast 4 characters long.';
}
왜 같은 대해 이메일과 일치하지 않습니다
하나는 데이터베이스에있는 오류 메시지를 던지고?
감사합니다. 그러나 pdo 만 사용하려고합니다. – crm
당신은 그 점을 제외하고 thats 할 수있다!! 내 매력의 중심은 SQL과 결과 로직 .. 당신이 원하는대로 쓸 수 있습니다 .. – manurajhada