On those lines, you would probably connect to your database outside the function.
with a little more explanation,
<?php
function check_number($num) {
//validate $num
if (is_numeric($num)) {
//tablename is the name of the members table
//member_id is the name of the field containing unique member numbers
$query = mysql_query("SELECT * FROM tablename WHERE member_id='$num'");
//check that there is a match
if (mysql_num_rows($query) == 1) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
?>