- My goal: I want to insert data from a form inside of an app. The insertion will take some of the form's data and insert is into a parent table. Other data (x amount of photos) needs to be inserted into a child table. I don't know how many photos my users will need to submit, so each photo is stored as its own row in the child table, using a foreign key to point back to the parent table.
- Issue: I don't know if the recommended approach is to write a custom query with a transaction statement in it, call a predefined procedure from the database schema, or use workflows to implement. I am worried about race conditions and inconsistent data so I want to make sure all insert statements run or none of them run.
The way I found to do what I want is nested if statements in mysql. I run insert statements for the photos based on the size of the file picker value array.
1 Like
Hi @Joshua_B,
Glad to hear you got this complex logic working with nested if statements in the MySQL DB.
I was going to ask about what the desired final outcome of inserting data from a form and an unknown number of images into a DB. Thank you for sharing the solution with the community for any other users that might be looking to set up the same logic!