Fixed connection to database for posting