An ìf (empty($row))` might actually make more sense here.