PHP Function to validate setting

I don’t know PDO or OOP :frowning:

<?php

// Connect to MySQL
$dsn = 'mysql:dbname=dev_pof;host=127.0.0.1';
$username = 'dev';
$password = 'dev.dev';

$pdo = new PDO($dsn, $username, $password,[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);

// Function to validate the flag value
function CheckFlagValue($pdo, $FlagName, $FlagValue)
{
    $sql  = "SELECT 1 FROM flags WHERE flagname = ? AND flagvalue = ? LIMIT 1";
    $stmt = $pdo->prepare($sql);
    $stmt->execute([$FlagName, $FlagValue]);
    return $stmt->fetchColumn();
}

// Function to get the flag description
function GetFlagDescription($pdo, $FlagName, $FlagValue)
{
    $sql  = "SELECT flagdescription FROM flags WHERE flagname = ? AND flagvalue = ? LIMIT 1";
    $stmt = $pdo->prepare($sql);
    $stmt->execute([$FlagName, $FlagValue]);
    return $stmt->fetchColumn();
}

echo GetFlagDescription($pdo, 'intent', 9);

?>

The GetFlagDescription function is working and shows the flag description when the flag name and value are passed.

However CheckFlagValue I need this function to return true or false depending on the row count. There doesn’t seem to be a row count function for PDO??