Home  >  Article  >  Backend Development  >  小弟我插入的时候,要怎么知道它分配的ID号是多少呢

小弟我插入的时候,要怎么知道它分配的ID号是多少呢

WBOY
WBOYOriginal
2016-06-13 13:41:20999browse

我插入的时候,要如何知道它分配的ID号是多少呢?

SQL code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
mysql> desc fb64_key;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| fbid  | int(11)     | NO   | PRI | NULL    | auto_increment |
| fbkey | varchar(16) | NO   |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)


fbid是自动分配ID的。。



SQL code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->INSERT INTO `webgame`.`fb64_key` (
`fbid` ,
`fbkey` 
)
VALUES (
NULL , '222'
);


我是用PHP怎么知道它分配的ID号是多少呢??谢谢

------解决方案--------------------
mysql_insert_id()
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn