How do I do a MySQL Insert statement into 2 different tables?
For instance, I want to do this:
-------------
table A
-------------
red
blue
-------------
table B
-------------
apple
blueberry
and I want to insert Orange into table A and Carrot into table B.
Observing members:
0
Composing members:
0
Answers
sounds to me like two separate insert statements... or maybe i don't understand the question...
yeah, I ended up doing it with two seperate statements....just thought that maybe I could simplify it
I thought there was a way to do this, but I think I was thinking of doing updates to multiple tables in one statement. After a quick search on Google, it seems it isn't possible to insert into multiple tables in one statement. But, this article offers a tip for simplifying the process using mysql_insert_id:
http://www.desilva.biz/mysql/insertid.html
Sounds like a job for a stored procedure.
Answer this question