format the result from the db