Let's say you have the username and password stored in $user and $pass. You would do something like:
mysql_connect('localhost','dbuser','dbpass');
mysql_select_db('db');
$r = mysql_query("select username from table where username='$user' and password='$pass'");
$numrows = mysql_num_rows($r);
if($numrows == 0) {
echo "Username or password is bad.";
exit;
}
/* continue on with whatever you want to happen when they log in correctly.. */