-
query roll back
about 9 years ago
-
about 9 years ago
HI
I think, you are testing Transaction by executing all queries in a correct format.
Please make any one query field wrong and then test, it will work. When you are removing $this->db->trans_complete(); it means that transaction has started and all queries are executed successfully, but as we know to see the saved data $this->db->trans_complete(); is must to commit all those queries.
If you want to check rollback is working correctly or not, make any field wrong in any loop index Like change name to namee and then check, it will really rollback.
Note:- Please check Database Engine, it should be InnoDB to implement Transaction
Regards
Deepak -
-
about 9 years ago
The code itself seems to be correct. However, one possible explanation to your problem is the type of storage engine your table is using.
MySQL do not support transactions for MyISAM engine. So if your table is using MyISAM, there is nothing codeIgniter could do. Check the storage engine your table is using. If it is MyISAM, change it to InnoDB.
-
2 Answer(s)