I seem to have tried every way to get my log in working however when i attempt to log in it stops at the users password and never fetches it.I am using sha1 in my register and that works fine when inserting into the database.

```
$username = $_POST['username'];
$password = md5($_POST['password']);

$result = mysql_query("SELECT * FROM users WHERE username = '$username' ");

while ($row = mysql_fetch_array($result))
{
    if($username == $row['username'] )
    {
        if( $password == $row['password'])
        {
            header("location: profile.php");
        }
        else    
            echo 'pass problem';
    }
    else

        echo 'username issue ';

}

```