What is the alternative approach to counting rows in a PDO query to check for the existence of a record?

When checking for the existence of a record in a PDO query, an alternative approach to counting rows is to use the `fetch()` method to retrieve a single row from the result set. If a row is returned, then the record exists; otherwise, it does not. This approach is more efficient than counting rows, especially for large result sets.

// Assume $pdo is your PDO connection object

$stmt = $pdo->prepare("SELECT * FROM your_table WHERE your_condition = :value");
$stmt->bindParam(':value', $your_value);
$stmt->execute();

$row = $stmt->fetch();

if ($row) {
    // Record exists
    echo "Record exists!";
} else {
    // Record does not exist
    echo "Record does not exist.";
}