programming languages – How to sent a alert mail in php?

I have created a login page to perform a sql injection, whenever the sql injection happens in login page admin should automatically get a alert mail. But I’m getting mail even when the user logged in correctly.
Login.html

    <!DOCTYPE html>
 <html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Login form </title>
 <link rel="stylesheet" type="text/css" href="style1.css">
 </head>
 <body>
     <div class="box">
     <form  action="insert.php" method="POST">
         <h1>Login</h1>
         <input type="text" name="username" placeholder="yourid@gmail.com">
         <input type="text" name="password" placeholder="Password">
         <input type="submit" name="submit" value="Login">
     </form>
    </div>
     </body>
 </html>

insert.php

<?php
if(isset($_POST('submit'))){ 
    $conn = mysqli_connect('localhost:3308','root', '')or die("connection error");
    mysqli_select_db($conn,"sqllogin");
$username =$_POST("username");
$password=$_POST("password");
$query="SELECT * FROM users WHERE username='$username' AND password='$password'";
    $result=mysqli_query($conn,$query);
    $count = mysqli_num_rows($result);

if($count > 0)
    {
    require 'PHPMailer/PHPMailerAutoload.php';
    $mail = new PHPMailer;

//$mail->SMTPDebug = 4;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'username@gmail.com';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->setFrom('username@gmail.com', 'abc');
$mail->addAddress('sample@gmail.com');     // Add a recipient
//$mail->addAddress('ellen@example.com');               // Name is optional
//$mail->addReplyTo('info@example.com', 'Information');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');

//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'sample';
$mail->Body    = 'sample checking';
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
header("Location:indexbook.html");

if(!$mail->send()) {

    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    
    echo"<h1> success</h1>";
    echo 'Message has been sent';
}
}
}
?>