Transactions not work ? |
[eluser]Tống Kiện Phi[/eluser]
This is my controller: Code: public function index() This is my Model: Code: public function insert($data) When i run http://localhost/ci/index.php/welcome it's insert new record into DB, but when i try run http://localhost/ci/index.php/welcome/rollback .. it's not rollback, So what am i doing wrong?
[eluser]sotoz[/eluser]
Hello. When you are calling the rollback function you have not started any query to rollback. When you call the controller's insert function you do one connection to the database and try to insert something (I bet the insert isn't working either without the commit) but the query doesn't "stay in memory" so you can rollback it anytime by calling a different controller function. You have to choose to rollback or commit a query at the runtime of the function you do the insert/update whatever. |
Welcome Guest, Not a member yet? Register Sign In |