简体   繁体   中英

Rollback Database Update After Refreshing a Page (PHP)

I have a php application where the user can make some changes to an oracle database with adodb .

After the request is executed, the page is refreshed and the user can see the result.

How would I add an undo option of this UPDATE after refreshing the page?

I've tried beginTrans() , but it seems like it automatically rollbacks after the php script is executed.

Database transactions are tied to a single connection. Connections are normally closed when the PHP script finishes and trying to make a connection persist for the same user on multiple requests would be very problematic.

As much as possible, it's best to treat HTTP requests as stateless. Meaning, changes should be committed to the database at the end of every request and an undo in HTTP should probably not be concerned with rolling back a previous transaction, but also actually committing changes in the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM