Advice on where I am going wrong with my login script
<p>I have the below login script and an admin_login script. When this is executed I'm getting the message to enter my username and password. So somewhere in the script I have gone wrong and for the life of me I can't find the mistake. I have tried a few different options. Would it be possible for somebody to point me in the right direction?</p>

<p>login.php page</p>

<pre><code>&lt;!--Connect to the database--&gt;
&lt;?php
$con=mysqli_connect("localhost","username","password","database");
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
?&gt;

&lt;?php

    session_start();

    $username = $_POST['username'];
    $password = $_POST['password'];


    if ($username&amp;&amp;$password)
    {
        $query = mysql_query("SELECT * FROM users WHERE username='$username'");                     
        $numrows = mysql_num_rows($query);
        if($numrows !=0)
        {
            while ($row = mysql_fetch_assoc($query))
                {
                    $dbusername = $row['username'];
                    $dbpassword = $row['password'];
                }
            if ($username==$dbusername&amp;&amp;$password==$dbpassword)
                {
                    echo "&lt;metahttp-equiv='REFRESH' content='3;url=http://admin.php'&gt;&lt;/HEAD&gt;&lt;p&gt;Login successful&lt;/p&gt;";
                    $_SESSION['username']=$dbusername;
                    $_SESSION['loggedin']=true;

                }
                else
                echo"&lt;meta http-equiv='REFRESH' content='1;url=http://login.php'&gt;&lt;/HEAD&gt;&lt;p&gt;Incorrect Username/Password&lt;/p&gt;";    
                }
                else
                die ("&lt;meta http-equiv='REFRESH' content='1;url=http://login.php'&gt;&lt;/HEAD&gt;&lt;p&gt;Please enter a username and password&lt;/p&gt;");
                }

?&gt;
&lt;img src="../images/loading_image.gif" width="200" height="200" /&gt;
&lt;/div&gt;
</code></pre>

<p>Below is the code for the admin_login.php</p>

<pre><code>&lt;?php
$con=mysqli_connect("localhost","username","password","database");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
?&gt;

&lt;?php 
    include('incs/header_login.php'); 
?&gt;

&lt;!--Content--&gt;
    &lt;div class="content"&gt;
        &lt;h1&gt;Log-in for Admin Pages&lt;/h1&gt;
        &lt;p&gt;Please enter username and password below&lt;/p&gt;
&lt;div class="admin_content_left"&gt;          

&lt;!--Creating the form for login --&gt;
 &lt;body&gt;

    &lt;form action="login.php" method="post"&gt;
        Username:&lt;input type="text" name="username"&gt;&lt;/br&gt;&lt;/br&gt;
    Password: &lt;input type="password" name="password"&gt;&lt;/br&gt;&lt;/br&gt;
        &lt;input type="submit" name="Submit" value="Login"&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/div&gt; &lt;!-- Close the Wrapper Div--&gt;
&lt;/html&gt; &lt;!-- Close HTML Tag --&gt;

&lt;!-- Footer --&gt;
&lt;?php 
    include('incs/footer.php'); 
?&gt;
</code></pre>
