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

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

WBOY
Release: 2016-06-13 13:41:20
Original
1024 people have browsed it

我插入的时候,要如何知道它分配的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)

Copy after login

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'
);
Copy after login


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

------解决方案--------------------
mysql_insert_id()
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template