queryDB function

A function to query the database