Logout code not executing at all. php
<p>Here is the code</p>

<p>I dont know whats wrong with it.</p>

<pre><code>&lt;?php
       //Logout code
       //Starting Session
       session_start();
       //Include
       include ("includes/mass.php");
       //Check if the user is logged in
       $username = $_SESSION['username'];
       $logged_in_query = "SELECT * FROM    user WHERE loggedin='1' AND    username='$username'";
       $check_if_logged_in =    mysql_query($logged_in_query);
       if (isset($username))

    {       while ($row =    mysql_fetch_array($check_if_logged_in))

            {
                $logged_in = $row['loggedin'];

                if ($logged_in == 1)

                    {
                    //User becomes logged out on database records

                    $sql_logout = "UPDATE user SET loggedin='0' WHERE loggedin='1' AND    username='$username'";

                    $logout_query = mysql_query($logout_query);

                    //Logout page

                    session_destroy();

                    echo "You have been logged out.","&lt;br&gt;"."&lt;a    href='index.php'&gt;Click Here To Go    Back&lt;/a&gt;";
                    }
                            }
                }                else

    {
                                echo"You are not logged in"."&lt;br&gt;&lt;a href='register.php'&gt;Click    To Sign Up&lt;/a&gt;";
                            }           
         ?&gt;
</code></pre>
