如何在php中创建自动增量功能 [英] How to Create Auto Increment function in php

查看:133
本文介绍了如何在php中创建自动增量功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我是一个年轻的php开发人员.我想为php中的ID字段创建一个自动递增功能.我怎么创建它?给我看看吗?首先谢谢!< pre></pre>

Hello all ! i am a young php developer.I want to create a auto increment function for ID Field in php .How could i create it ? show me some? thank you first!<pre></pre>

推荐答案

PHP不负责自动递增.这是由数据库引擎完成的.我假设您使用MySQL.在这种情况下,您应该将AUTO_INCREMENT属性应用于ID字段.

请查看此链接以获取更多信息:

http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html [ ^ ]

祝你好运!
PHP is not responsible for the auto increment. This is done by the database engine. I assume you use MySQL. In that case you should apply the AUTO_INCREMENT attribute to the ID field.

Have a look at this link for more info:

http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html[^]

Good luck!


我尝试使用auto_increment attr,但是当我删除记录数时,仍然会增加一倍.因此,如果您有其他解决方案,请帮帮我.谢谢
I try to use auto_increment attr but when i delete a record number still increase over one.so if you have other solution help me. thank


这篇关于如何在php中创建自动增量功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆