A more generic way to get some results from the database.
Do not forget to clear memory.