问题:
有两个表: table1,table2
table1里的字段有:
id title content table2里的字段有:
id cid user 其中CID为table1中的IDtable1通过 insert into 生成一个数据后,同时将table1中的 id 写到table2中,怎么实现啊? 如下:
table1:
id title content
1 test 内容
2 test2 内容2table2:
id cid user
1 1 用户
2 2 用户2
谢谢~~
有两个表: table1,table2
table1里的字段有:
id title content table2里的字段有:
id cid user 其中CID为table1中的IDtable1通过 insert into 生成一个数据后,同时将table1中的 id 写到table2中,怎么实现啊? 如下:
table1:
id title content
1 test 内容
2 test2 内容2table2:
id cid user
1 1 用户
2 2 用户2
谢谢~~
取得上一步 INSERT 操作产生的 ID 再插入table2
不怎么明白 ,我知道mysql_insert_id();可以产生最后的ID,但是怎么将其用在第二个表中呢?
THANKS!
当table1插入时,向table2插入数据