How do I set the IF ELSE condition in PDO?
I want to be able to echo the results if there are records with faced = 'N'. OR echo 'Empty'.
$query = $db->prepare('SELECT student, subject FROM my_db WHERE faced = ? ORDER BY RAND() LIMIT 1');
$array = array('N');
$query->execute($array);
if ($query>0){
$result = $query->fetchAll(PDO::FETCH_ASSOC);
var_dump($result);
} else {
echo 'Empty';
}