checking only email, not username : I have this code which checks email availability from database, but it's only checking email and not username, I want to check email and username both, I tried to check both through below code but it doesnt works.
What is wrong in the code?



    <?php
    require_once './config.php';
    if (isset($_POST["sub"])) {
    $fname =($_POST["fname"]);
    $lname =($_POST["lname"]);
    $name = ($_POST["username"]);
    $pass = ($_POST["password"]);
    $email =($_POST["email"]);
    $sql = "SELECT COUNT(*) AS count from users where email = :email_id and username = :username_id ";
    try {
    $stmt = $DB->prepare($sql);
    $stmt->bindValue(":email_id", $email);
    $stmt->bindValue(":username_id", $email);
    $stmt->execute();
    $result = $stmt->fetchAll();
  
    if ($result[0]["count"] > 0) {
    echo "<div style='color:red;' class='errorbox'>Incorrect Username or Password</div><br>";
    } 
    else {
    $sql = "INSERT INTO `users` (`username`, `password`, `email`, `firstname`, `lastname`) VALUES " . "( :name, :pass, :email, :fname, :lname)";
    }
    }
    }
    ?>