if i want to insert into two tables very similar data, the first table has an id which is the primary key and auto_increment, the second has id that is only primary key, but how do i set the second table's id, to be identical to the first table's autoincremented id ?
inserting data into two tableswith the same id
Page 1 of 1
2 Replies - 5264 Views - Last Post: 02 May 2006 - 01:35 AM
Replies To: inserting data into two tables
#2
Re: inserting data into two tables
Posted 02 May 2006 - 01:19 AM
k i found it, thanks theRemix!
http://dev.mysql.com...-insert-id.html
if anyone is as noobish as me...
http://dev.mysql.com...-insert-id.html
if anyone is as noobish as me...
INSERT INTO tbl (auto,text) VALUES(NULL,'text'); INSERT INTO tbl2 (id,text) VALUES(LAST_INSERT_ID(),'text');
#3
Re: inserting data into two tables
Posted 02 May 2006 - 01:35 AM
is
the same as
?
$query1 = "DELETE FROM products WHERE id = '$id' AND cid = '$cid'"; $query2 = "DELETE FROM thumbsProducts WHERE id = '$id' AND cid = '$cid'";
the same as
$query1 = "DELETE FROM products,thumbsProducts WHERE id = '$id' AND cid = '$cid'";
?
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|