How to prompt if the user is existing in database :     <?php 
    include('dbcon.php');
    $code = $_POST['code']; 
    $result=mysqli_query($dbcon,"INSERT into attendance(firstname,lastname,type,year_level,date_added)Select firstname,lastname,type,year_level,CURRENT_TIMESTAMP() FROM member WHERE code='$code'") or die("Error ".mysqli_error());

    if(isset($_POST['submit']))
    {  
    if(!$result) {

            echo "Database NOT Found.";
    } else {
    $result;
    header('location:add_member_attendance.php');

    }
    } else {           
    }  
    ?>

I want to display prompt if it successfully entered the data and if the user is not found in database but I don't know what problem of my code. Thanks for helping me 
