不同身份证的处理
我正在使用 PHP 和 MySQL 制作一个表单,我需要注册具有不同 ID 卡的用户(有些是组织,其他来自其他国家;有些是数字,其他有字母),并且我需要该 ID 是唯一的,以便以一种简单的方式加载用户数据,但我不知道如何面对这种情况。
我想听听您的专家建议,以尽可能最好的方式去做。
在表单中,有时一个用户引用其他用户,例如有一个字段“赞助商”,其想法是仅写入他的 ID 即可加载赞助商数据。
我真的很感激任何建议。
I'm making a form using PHP and MySQL and I need to register users that have different ID Cards (Some are organizations, other are from other countries; some are numerics other have letters) and I need that ID to be unique in order to in an easy way load the user data, but I don't know how to face up this situation.
I want to listen your expert advice to do in the best way as possible.
In the form sometimes one user refer to others, for example there is a field "sponsor" and the idea is to load the sponsor data only writing his ID.
I really appreciate any suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法保证身份证上的号码在全世界都是唯一的。
您的用户表需要一个与其他数据分开的 ID 列。整数通常就可以了。
然后,您必须使用卡号进行搜索,如果出现多次搜索,还必须使用有关该客户的已知其他属性进行搜索。
You can not guarantee that numbers on ID-cards are unique across the whole world.
Your user table needs an ID-column that is separate from other data. An integer is usually fine.
You would then have to search using the card number and, in case of more than one hit, other attributes that are known about the customer.