$count should be boolean. The point of the method is to tell whether or not the data exists, not how many items there are. You can either cast it to boolean on variable definion, instead of (int), or you can cast it during the return.