samedi 2 juillet 2016

Checking for duplicates in two tables with same name columns

I am an amateur with limited programming language, please help. I have the following code :

try
  {
     $stmt = $DB_con->prepare("SELECT user_email FROM m_users WHERE user_email=:umail");
     $stmt->execute(array(':umail'=>$umail));
     $row=$stmt->fetch(PDO::FETCH_ASSOC);

     if($row['user_email']==$umail) {
        $error[] = "Sorry but someone has already registered with this email address !";
     }
     else
     {
        if($user->register($umail,$ucountry,$uip)) 
        {
            $user->redirect('m_c.php');
        }
     }
 }
 catch(PDOException $e)
 {
    echo $e->getMessage();
 }

This code - as it is - looks for duplicate emails in just one table called m_users and throws a notification if it finds one.

What I want is that it looks and checks AS WELL in an additional table called f_users, which has EXACTLY the same column structure. I tried different tricks to no avail. Many thanks in advance.

Aucun commentaire:

Enregistrer un commentaire