Check for PDO Results, If None Display Message, If Yes then Loop Through
PHP Snippet 1:
$results = $stm->fetchAll();
if(empty($results))//or if(!$results) or if(count($results)==0) or if($results == array())
{
echo 'Nothing found';
}
else
{
foreach($results as $result)
{
//do stuff
}
}
PHP Snippet 2:
$stm->execute();
if($stm->rowCount() == 0)
{
echo 'Nothing found';
}
else
{
//do your stuff
}