php - mysql insert rows in multiple tables -


i have database multiple tables, in al tables there have row because else query going wrong. in 1 of insert pages insert al rows seperatly in tables. there more efficient , safe way this? maybe in mysql (cascade)?

afaik there no other way same data different tables in same statement. can try using transactions.

start transaction; insert t1 (field1, field2) values ('data1','data2'); 

after inserting data can check them if ok , if expected commit queries:

commit; 

or rollback, removes changes sience "start transaction".

rollback; 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -