added database connection to addPost