Forum Moderators: open

Message Too Old, No Replies

Insertion into multiple table through single query in mysql

mysql query, insertion into multiple table, mysql insertion

         

abidshahzad4u

2:59 pm on May 12, 2009 (gmt 0)

10+ Year Member



How can I insert data from a form into multiple tables through one query in mysql?

Demaestro

4:03 pm on May 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In SQL you can only make an insert statement for 1 table per statement.

You can prepare multiple statements and then execute them together in a transaction. Something like:

transaction = """
insert a into tablea;
insert b into tableb;
insert c into tablec;"""

sql_execute(transaction)