如何用字母表制作ID [英] How to make ID with alphabet

查看:112
本文介绍了如何用字母表制作ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要有关用户ID的帮助。我希望在用户ID中生成带有3或4个字母的ID

Hi,

I need help about user id. I want generate ID with 3 or 4 Alphabet in user ID

Exp: LD0001

并且用户ID是递增的。知道怎么做吗?



我尝试过:



我在google中找到了这个

MySQL

and the user id is increment. Any idea how to make it?

What I have tried:

I found this in google
MySQL

CONCAT





但仍然不要如何在PHP中使用它



But still don't how to use it in PHP

推荐答案

为什么不向您的数据库询问该唯一ID [ ^ ]






检查这个...



如果你的aplha部分是固定的,那么就不需要存储它只需使用查询。

Hi,

check this...

if your aplha part is fixed, then no need of storing it simply make use of query.
Select 'LD'+right('00000'+cast(userid as varchar),5) AS aplhnumeric_Id





希望这会对你有所帮助。



干杯



Hope this will help you.

Cheers

这篇关于如何用字母表制作ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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