CodeIgniter Forums
Multiple db queries? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Multiple db queries? (/showthread.php?tid=50709)



Multiple db queries? - El Forum - 04-05-2012

[eluser]Madtrooper[/eluser]
Hey guys!

I have another newbie question for you guys!

When a user submits a form, and the data gets uploaded to the database, it's perfectly possibly to check wether the upload is completed successfully.

But what when your form needs to be uploaded to lets say 2 or more tables? You can check both queries seperately for completion, but what if the first one succeeds and the second one somehow fails? Then you're stuck with a half-uploaded form in your database, right?

How does one catch this?

Thanks in advance!


Multiple db queries? - El Forum - 04-05-2012

[eluser]gRoberts[/eluser]
Take a look at Transactions (http://ellislab.com/codeigniter/user-guide/database/transactions.html) Wink

Your input should not cause any issues if you validate it correctly before inserting.