I don't recommend making two requests to MySQL. If you have a big database, it will consume too many resources just for the login script. Make a single request and get all of the user data in that single request. Then compare passwords, simple as that.