Straightforward function - simply connect to the database and execute a query, similar to this function bellow.
<?php
function check_password($username, $password) {
$db = new mysqli('localhost','database_user','database_pass','database_name');
if($db->connect_errno){
echo $db->connect_error;
}
$result = $db->real_query("Select * From users Where username='$username' And password='$password'");
if($db->connect_errno){
echo $db->connect_error;
}
return $result == true;
}
?>
Very easy.
Replace database_user, database_pass and database_name with the proper names, and the text inside real_query with your actual query.
Don't forget the quotes on either side (except for numbers, there you can omit them) otherwise it won't work. Hope that helps someone.