here is my database:
table 1: dog
column 1: email
column 2: password
table 2: cat
column 1: email
column 2: password
i want to check if a string or data already exists or not in a column from two databases:
//check if email exists in either dog or cat.
$stmt = $dbh->prepare("SELECT email FROM dog AND cat WHERE email = :email");
$stmt->bindParam(':email', $email);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
//if the email exists in either dog or cat, echo the "taken" message below
if($row['email'] == $email) {
echo "sorry, the email is taken already!";
}
but it is not working for me. how can i make it work?