Your code is never actually getting to the database part. It either redirects or exits the sub.