I'm developing a php/MySQLi based site. I have a question about what might happen if the page for some reason crashes in the middle of executing a complex procedure.
Example:
if (get_message_call)
{
add something to table 1
add something to table 2
add something to table 3 ( based on some values inserted into table2 )
add something to table 4
etc...
}
I've built the database using PHPmyAdmin (InnoDB). I haven't assigned any relations though since primary/foreign keys didn't work out as in theory (perhaps i dit it wrong).
My main concern is that if the statement for some reason gets aborted (page crash, loose connection etc) in the middle of lets say executing the "add something to table3". I guess that the first and second statement will get executed, and the rest wont?
What is the best way to ensure that this wont be possible to occur since it might mess up the keys etc for the other tables.. i might be a bit fuzzy with the explenation but i hope someone understands my point.
I've read about "Rollbacks and Commits in Stored Procedures and Triggers" but i'm not sure if i understood it right..
Thanks in advance.