PHP Function to validate setting

There is one critical problem and two improvements that can be made.

The problem is that nowhere $stmt is defined. You have to create it out of $mysqli instance that have to be added to function parameter list.

First improvement belongs to SQL where you can use BETWEEN clause and thus avoud binding the same variable twice.

Another one is based on the extreme verbosity of raw mysqli API. I strongly recommend you to use PDO instead. Look how dramatically shorter your code could be with PDO:

// Validate flag value
function ValidateFlagValue($pdo, $FlagName, $FlagValue)
{
    $sql  = "SELECT 1 FROM flags WHERE flag_name = ? AND ? BETWEEN flag_min AND flag_max LIMIT 1";
    $stmt = $pdo->prepare($sql);
    $stmt->execute([$FlagName, $FlagValue]);
    return $stmt->fetchColumn();
}

PDO not only lets you avoid manual binding at all, but also have a very handy function to return the query result at once.

So again, consider PDO instead of mysqli. Give PDO a try and you will see how powerful it can be.