My purpose in testing whether or not any rows are returned is to prevent a situation where the final $AssignmentIDs variable point at an empty string.
I am using this variable in my next SQL statement using the IN syntax. For example,
SELECT ... FROM ... WHERE AssignmentID IN ($AssignmentIDs)