Added function to print results to sql db