$sth = $pdo->prepare(
"SELECT 1
FROM `ok`
WHERE `val` = ?
LIMIT 1"
);
$sth->execute([$val]);
if ($sth->rowCount() > 0) {
printf("Value %s found in table `ok` column `val`", $val);
} else {
printf("Value %s not found in table `ok` column `val`", $val);
}