PHP-MySQL:在创建新记录时返回ID? [英] PHP-MySQL: Returning ID when new record is made?
问题描述
让我们说我在这样的表中创建一条新记录:
mysql_query(" INSERT INTO table(col1)VALUES(''example'')",$ conn );
....它有一个自动递增的唯一标识列,名为ID
,将填充一个唯一的编号插入...
如何获得分配给该记录的唯一编号
进一步使用?
- -
[Sugapablo]
[ http:/ /www.sugapablo.com < - music]
[ http://www.sugapablo.net < - personal]
[ su*******@12jabber.com < - jabber IM]
Let''s say I create a new record in a table like this:
mysql_query("INSERT INTO table (col1) VALUES (''example'')",$conn);
....that had an auto-incrementing, unique identifying column named "ID"
that would be populated with a unique number upon insertion...
How can I get the unique number it assigned to that record returned for
futher use?
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ su*******@12jabber.com <--jabber IM ]
推荐答案
conn);
....具有自动递增,唯一识别功能名为ID的列
将在插入时填充唯一编号...
如何获取分配给该编号的唯一编号记录返回
进一步使用?
-
[Sugapablo]
[ http://www.sugapablo.com < - music]
[ http://www.sugapablo.net < - personal]
[ su*******@12jabber.com < - jabber IM]
conn);
....that had an auto-incrementing, unique identifying column named "ID"
that would be populated with a unique number upon insertion...
How can I get the unique number it assigned to that record returned for
futher use?
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ su*******@12jabber.com <--jabber IM ]
2003年11月26日星期三18:47:46 -0000,Sugapablo< ru ******** @ sugapablo.com>写道:
On Wed, 26 Nov 2003 18:47:46 -0000, Sugapablo <ru********@sugapablo.com> wrote:
让我们说我在这样的表中创建一条新记录:
mysql_query(" INSERT INTO table(col1)VALUES(''example') ')",
Let''s say I create a new record in a table like this:
mysql_query("INSERT INTO table (col1) VALUES (''example'')",
conn);
...有一个名为ID的自动递增的唯一标识列
将在插入时填入一个唯一的编号...
如何获得为该记录分配的唯一编号以便进一步使用?
conn);
...that had an auto-incrementing, unique identifying column named "ID"
that would be populated with a unique number upon insertion...
How can I get the unique number it assigned to that record returned for
futher use?
http://uk2.php.net/manual /en/ref.mysql.php
-
Andy Hassall(an**@andyh.co.uk)icq(5747695) )( http://www.andyh.co.uk )
空间:磁盘使用情况分析工具( http://www.andyhsoftware.co .uk / space )
http://uk2.php.net/manual/en/ref.mysql.php
--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
这篇关于PHP-MySQL:在创建新记录时返回ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!