Edit function working with SQL database.