transaction Mysql with php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jx2
    New Member
    • Feb 2007
    • 228

    transaction Mysql with php

    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=tab le2.key1
    rec1='data...' , rec2='another data...'

    key1 are an interger value auto_increment

    any idea?
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    You can try

    UPDATE table1, table2 SET
    table1.rec1='da ta...' ,
    table2.rec2='an other data...'
    WHERE table1.key1=tab le2.key1

    For more information on updating multiple tables visit http://dev.mysql.com/doc/refman/5.0/en/update.html

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Check out this article on how to use foreign keys:

      Comment

      Working...