helper function to get some information out of the database