For example:
$sql = 'select a, b, c from table where condition';
$stmt->prepare($sql);
$stmt->execute();
$data = $stmt->fetch();
AND
$sql = 'select a, b, c from table where condition';
$stmt->prepare($sql);
$stmt->execute();
$data = $stmt->fetchAll();
How to check if result set is empty or not
Check $data
variable like:
if ($data) {
//not empty
} else {
// empty
}
if result of select
query did not consist any data variable $data
will consist null
value.