Start out with
SQL Tutorial[
^]. And depend on how you build up the table that holds the user info. SELECT statement can vary.
One example can be:
SELECT id FROM useraccess WHERE login='kim' AND SHA1(password)=SHA1('mypass')
It will give 1 result, if login and password macth login.
Please see this great tip
Password Storage: How to do it.[
^]