say have 2 tables:
table1 (id, name, type)idprimary key, , auto-incrementedtable2 (item_id, place)item_idrefersidintable1
i want following:
insert table1(name, type) values (y, z); assuming that query assign id=x row, then:
insert table2(item_id, place) values (x, w); how that? in other words, how id of row has been added?
insert table1(name, type) values (y, z); insert table2(item_id, place) values (last_insert_id() , w); the last_insert_id() you. programming languages have special function call you, works in pure mysql.
Comments
Post a Comment