This is what I personally use for a login script you would just have to change the code to fit you database structure and just pass a username and password variable through a form.
$result = mysql_query("Select * from table where username = '$username' and password = '$password'");
if (mysql_num_rows($result)> 0){
$message = "You have successfully logged into your account";
setcookie ("UserName", $username,time()+3600);
} else {
$message = "Your Username and Password does not match. Please try again or register for a new account";
}