An Internal Error has Occured. Please report following error to the webmaster [closed]

I am working in a PHP Script where a Form is submitted in same file. I am using Linux Mint Operating System. My Script is like below.

<?php

require_once "../codelibrary/inc/variables.php";
require_once "../codelibrary/inc/functions.php";
?>
<!doctype html>
<!--[if lte IE 9]> <html class="lte-ie9" lang="en"> <![endif]-->
<!--[if gt IE 9]><!-->
<html lang="en"> <!--<![endif]-->

<head>
    <?php

    if (!isset($_SESSION['num1']) && !isset($_SESSION['num2'])) {
        $_SESSION['num1'] = rand(1, 5);
        $_SESSION['num2'] = rand(1, 5);
    }

    if (!empty($_SESSION['boat_admin_id'])) {
        //   header("location:dashboard.php");
        header("location:main_courses.php");
    }

    if (1 == $submitfrm) {
        $techfetch  = mysql_query_db("select * from tbl_teacher where email='$username' and password='$password' and status=1");
        $ntectfetch = mysql_num_db($techfetch);

        if ($ntectfetch > 0) {
            $fntectfetch                 = mysql_fetch_db($techfetch);
            $_SESSION['boat_teacher_id'] = $fntectfetch['id'];
    ?>
            <script>
                location.href = "teacher/profile.php";
            </script>
            <?php } else {
            //echo "select * from tbl_admin where email='$username' and password='$password' and status=1";
            $dt  = mysql_query_db("select * from tbl_admin where (username='$username' || email='$username') and password='$password' and status=1");
            $ndt = mysql_num_db($dt);

            if ($ndt > 0) {
                $fdt                       = mysql_fetch_db($dt);
                $_SESSION['boat_admin_id'] = $fdt['id'];
                $_SESSION['user_type']     = $fdt['user_type'];

                if (2 == $_SESSION['user_type']) {
                    $_SESSION['impersonate'] = true;
            ?>
                    <script>
                        location.href = "manager_dashboard.php";
                    </script>
                <?php } else { ?>
                    <script>
                        //  location.href="dashboard.php";
                        location.href = "main_courses.php";
                    </script>
                <?php }
                ?>
    <?php //header('location: dashboard.php');
            } else {
                header('location:index.php?msg=error');
            }
        }
    }

    ?>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <link rel="icon" type="image/png" href="assets/img/favicon-16x16.png" sizes="16x16">
    <link rel="icon" type="image/png" href="assets/img/favicon-32x32.png" sizes="32x32">

    <title><?php echo SITE_TITLE; ?> - Secure Admin Panel</title>

    <link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500' rel='stylesheet' type='text/css'>

    <!-- uikit -->
    <link rel="stylesheet" href="<?php echo SITE_PATH; ?>admin/admincj/uikit.almost-flat.min.css" media="all">

    <!-- altair admin login page -->
    <link rel="stylesheet" href="<?php echo SITE_PATH; ?>admin/admincj/login_page.min.css" />

    <style type="text/css">
        input.error,
        textarea.error {
            border: 1px solid red;
            box-shadow: 0 0 4px red;
        }

        label.error {
            display: none !important;
        }

        input.error,
        textarea.error {
            -moz-animation: glow ease-in infinite alternate 500ms;
            -webkit-animation: glow ease-in infinite alternate 500ms;
            -ms-animation: glow ease-in infinite alternate 500ms;
            animation: glow ease-in infinite alternate 500ms;
        }

        @-moz-keyframes glow {
            0% {
                box-shadow: 0 0 4px red;
            }

            100% {
                box-shadow: 0 0 9px red;
            }
        }

        @-webkit-keyframes glow {
            0% {
                box-shadow: 0 0 4px red;
            }

            100% {
                box-shadow: 0 0 9px red;
            }
        }

        @-ms-keyframes glow {
            0% {
                box-shadow: 0 0 4px red;
            }

            100% {
                box-shadow: 0 0 9px red;
            }
        }

        @keyframes glow {
            0% {
                box-shadow: 0 0 4px red;
            }

            100% {
                box-shadow: 0 0 9px red;
            }
        }
    </style>

</head>

<body class="login_page">
    <div class="login_page_wrapper">
        <div class="md-card" id="login_card">
            <div class="md-card-content large-padding" id="login_form">
                <div class="login_heading">
                    <h2>ADMIN LOGIN</h2>
                    <!--<div class="user_avatar"></div>-->
                </div>
                <form action="" name="loginForm" id="loginForm" method="post">
                    <input type="hidden" name="submitfrm" value="1">

                    <div class="uk-form-row">
                        <label for="login_username">Email</label>
                        <input class="md-input" type="text" required id="username" name="username" />
                    </div>
                    <div class="uk-form-row">
                        <label for="login_username">Password</label>
                        <input class="md-input" type="password" required id="password" name="password" />
                    </div>
                    <!--<div class="uk-form-row">
                        <label for="login_username"><div style="background-image: url(jquery/captha_bg.jpg); padding: 0 10px;
width: 48px; font-weight: bold; color: #E0C8C8;" ><?php //echo $_SESSION['num1']; ;
                                                    ?>+ <?php //echo $_SESSION['num2']; ;
                                                                                        ?> ?</div></label>
                        <input class="md-input" type="text" id="captcha" name="captcha" />
                    </div>-->
                    <div class="uk-margin-medium-top">
                        <button type="submit" class="md-btn md-btn-primary md-btn-block md-btn-large">Sign In</button>
                    </div>
                    <!--<div class="uk-margin-top">
                        <span class="icheck-inline">
                            <input type="checkbox" name="login_page_stay_signed" id="login_page_stay_signed" data-md-icheck />
                            <label for="login_page_stay_signed" class="inline-label">Stay signed in</label>
                        </span>
                    </div>-->
                    <?php

                    if (isset($_GET['msg'])) {
                    ?>
                        <div class="uk-margin-top">
                            <span class="icheck-inline">
                                <label style="color:red;" for="login_page_stay_signed" class="inline-label">Email or password dosenot match</label>
                            </span>
                        </div>
                    <?php
                    }

                    ?>
                </form>
            </div>
            <div class="md-card-content large-padding uk-position-relative" id="login_help" style="display: none">
                <button type="button" class="uk-position-top-right uk-close uk-margin-right uk-margin-top" id="login_help_close"></button>
                <h2 class="heading_b uk-text-success">Can't log in?</h2>
                <p>Here’s the info to get you back in to your account as quickly as possible.</p>
                <p>First, try the easiest thing: if you remember your password but it isn’t working, make sure that Caps Lock is turned off, and that your username is spelled correctly, and then try again.</p>
                <p>If your password still isn’t working, it’s time to <a href="#" id="login_password_reset_show">reset your password</a>.</p>
            </div>
            <div class="md-card-content large-padding" id="login_password_reset" style="display: none">
                <h2 class="heading_a uk-margin-large-bottom">Reset password</h2>
                <form action="">
                    <div class="uk-form-row">
                        <label for="login_email_reset">Your email address</label>
                        <input class="md-input" type="text" id="login_email_reset" name="login_email_reset" />
                    </div>
                    <div class="uk-margin-medium-top">
                        <button class="md-btn md-btn-primary md-btn-block">Reset password</button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <!-- common functions -->
    <script src="<?php echo SITE_PATH; ?>admin/admincj/js/common.min.js"></script>
    <!-- altair core functions -->

    <!-- altair login page functions -->
    <script src="assets/js/pages/login_page.min.js"></script>

    <script src="<?php echo SITE_PATH; ?>admin/admincj/js/altair_admin_common.min.js"></script>
    <!--<script src="jquery/jQuery1.8.3.js"></script>-->
    <script src="<?php echo SITE_PATH; ?>admin/admincj/jQuery.validation.1.10.0.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $.validator.addMethod("nourl", function(value, element) {
                return !/https://|www.|link=|url=/.test(value);
            }, "No URL's");

            $("form").validate({
                rules: {
                    username: {
                        required: true,
                        //email: true
                    },
                    password: {
                        required: true
                    }

                },
                messages: {
                    username: "",
                    password: "",
                }
            });
        });
    </script>
</body>

</html>

It is a Login Form. When I am submitting the form I am getting error An Internal Error has Occured. Please report following error to the webmaster. select * from tbl_teacher where email='' and password='' and status=1

enter image description here

I checked /var/log/apache2/error.log file. It is empty. There is no error.

Why I am getting this error ?