By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,827 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

transaction Mysql with php

100+
P: 228
i have 2 tables
table1 (key1 int primary key auto_increment, rec1 varchar(255))
table2 (key1 int primary key, rec2 varchar(255))
i need to insert data where table1.key1=table2.key1
rec1='data...' , rec2='another data...'

key1 are an interger value auto_increment

any idea?
Apr 28 '07 #1
Share this Question
Share on Google+
2 Replies


mwasif
Expert 100+
P: 801
You can try

UPDATE table1, table2 SET
table1.rec1='data...' ,
table2.rec2='another data...'
WHERE table1.key1=table2.key1

For more information on updating multiple tables visit http://dev.mysql.com/doc/refman/5.0/en/update.html
Apr 28 '07 #2

pbmods
Expert 5K+
P: 5,821
Check out this article on how to use foreign keys:
http://dev.mysql.com/doc/refman/5.0/...eign-keys.html
Apr 28 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.