Makes sure a query has items before iterating over it

If a query yields no results and we proceed to iterate over it, the
returned object will be empty and PHP will die with an error such as
this one:

PHP Fatal error:  Call to a member function fetch() on a non-object in /usr/share/collabtive/www/include/class.milestone.php on line 527, referer: http://localhost/collabtive/index.php

This patch ensures there are items to iterate before beginning to do so.

Please note that, while overall operation was checked after applying
these fixes, I cannot assure the patch is sufficient — Check before
applying!