php mysql_insert_id在多行上? [英] php mysql_insert_id on multiple rows?
本文介绍了php mysql_insert_id在多行上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从插入多行的查询中获取自动递增的ID? 例如:
Is it possible to get the auto incremented ids from a query which inserts multiple rows? eg:
INSERT INTO表(col1,col2)值(1、2),(3、4),(5、6);
INSERT INTO table (col1, col2) VALUES (1, 2), (3, 4), (5, 6);
或者,是否有一种方法可以找到NEXT自动增量值而无需在表中插入任何内容?
Alteratively, is there a way to find the NEXT auto increment value WITHOUT inserting anything into the table?
谢谢
推荐答案
据我所知,auto_increment不能填补id之间的空白,并且该操作是原子的.因此,您可以假设它们将连续出现.
As far as I know auto_increment does not fill gaps between ids and the operation is atomic. So you can assume that they will be in a row.
这篇关于php mysql_insert_id在多行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文