创建顺序ID号 [英] Creating a Sequential ID Number

查看:73
本文介绍了创建顺序ID号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以帮我解决这个问题。我有一个脚本,里面有一堆代码。由于某种原因,编码器决定使用十六进制作为id号(它只是一个成员号,没什么秘密)无论如何我要改变的代码部分是:

I was wondering if anyone could help me out with this problem. I have a script that has a bunch of code in it. For some reason the coder decided to use a hex for a id number (it''s just a member number, nothing secret) anyway the code section that I want to change is this :

展开 < span class =codeDivider> | 选择 | Wrap | Line数字

推荐答案

你的编码器没有直接使用十六进制 - 这是来自散列函数md5,随着输入的变化而变化很大。如果不是必须隐藏的东西,为什么不在数据库ID中添加一个5位数?


例如,如果你一直向id添加50000,那么数字将永远是5位数(除非你的成员数量导致它变为6位数,当然)。
Your coder didn''t use hex directly -- that''s coming from the hashing function md5 which changes substantially as the input changes. If it''s not something that has to be hidden why not add a 5 digit number to the db id?

For example, if you consistently add 50000 to the id, the number will always be 5 digits (unless your number of members causes it to go to 6 digits, of course).



你的编码器没有'直接使用十六进制 - 这来自散列函数md5,随着输入的变化而变化很大。如果不是必须隐藏的东西,为什么不在数据库ID中添加一个5位数?


例如,如果你一直向id添加50000,那么数字将永远是5位数(除非您的会员数量导致它变为6位数,当然)。
Your coder didn''t use hex directly -- that''s coming from the hashing function md5 which changes substantially as the input changes. If it''s not something that has to be hidden why not add a 5 digit number to the db id?

For example, if you consistently add 50000 to the id, the number will always be 5 digits (unless your number of members causes it to go to 6 digits, of course).



嗨Jeremy,


感谢您的回复。我的问题是我的会员ID就像3e45jk1p一样。我想要的是他们从1开始并从那里顺序进行。我不一定需要每个id为5位数。我只希望我不需要超过5位数。


Hi Jeremy,

Thank you for your response. My problem is that my member ids are coming like "3e45jk1p" what I want is for them to start at 1 and proceed sequentially from there. I don''t necessarily need each id to be 5 digits long. I would just expect that I would not need to exceed 5 digits.


哦,然后是:


1)使用当前的自动增量字段'的价值,或者

2)创建一个新的自动增量字段并使用它的价值。


如果你只是使用它的价值该字段,然后#1是首选方式,因为#2创建了不必要的重复。
Oh, then either:

1) Use the current autoincrement field''s value, or
2) create a new autoincrement field and use it''s value.

If you''re just using the value of the field, then #1 is the preferred way as #2 creates unnecessary duplication.


这篇关于创建顺序ID号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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