Welcome Guest, Not a member yet? Register   Sign In
Editing unique data post input.
#3

Validating that data has not changed is always an issue with RESTless applications like the ones you get in a web browser. One solution is to create and store a hash value of the values you want to validate (MD5 is fine as it is for comparison, not security) and store that as a field in the database. Before you write your changes back, you need to check you existing hash and compare it to the value in the database. If they are not the same then someone has modified the record since you fetched it and you will need to abandon the changes. If the changes are part of a group (e.g. editing a line in an order) then you may need to abort all the updates. to do this you will need to $this->db->transaction->begin() before the first record and $this->db->transaction->end() after the last record or £this->db->transaction->rollback() if you want to abort the updates.
Reply


Messages In This Thread
Editing unique data post input. - by miiikkeyyyy - 03-02-2015, 06:33 PM
RE: Editing unique data post input. - by obiron - 03-03-2015, 01:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB