CodeIgniter Forums
CI transaction on functions - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: CI transaction on functions (/thread-28624.html)

CI transaction on functions - El Forum - 03-17-2010

Hi guys,

Currently creating a cart system for a company with CI. In the last step of the checkout i call a lot of functions like; create user, create order, order detail and more.

I need to check if any of these function went ok, and if not; use a transaction.

I've read this: but this will only work if you create a list of DB queries between the trans_start and trans_complete.

Is there something like a transaction possibility using functions?

Looking forward to your reply.


CI transaction on functions - El Forum - 03-17-2010

Maybe I don't understand the problem but it sounds like you just need to check the return value(s) of your functions. If one of them failed abort the rest the process and rollback the database.