mysql - 如果“a”==“b”echo“折扣”

I'm searching for a method to solve my problem.

If the e-mail I search for is in both my databases, it should echo "discount", else it should echo "no discount"

 //Database is connected
 $amail= "SELECT `mail` FROM `wunderte_wp793`.`Newsmail` WHERE `mail` =  (\'" . $_GET['mail'] . "\');";
        $resultamail =  $mysqli->query($amail); // query

 $email= "SELECT `email` FROM `wunderte_wp793`.`message` WHERE `email` =  (\'" . $_GET['mail'] . "\');";
        $resultemail =  $mysqli->query($email); // query

 while($resultamail == $resultemail){
        echo "Discount";
           }

        else {
        echo "NULL discount";
            }

use MySQL if

SELECT if(mail=email,'Discount','NULL discount') result FROM 
`wunderte_wp793` 
WHERE `mail` =  'xyz' or email='xyz'

MySQL IF function is one of the MySQL control flow functions that returns a value based on a condition.