Make a lottery system
林瑞程
林瑞程 2019-12-05 20:34:28
0
9
1580

I am going to use TP5.1 to build a lottery system. When the name of the user field username (lottery user) in the database is the same, for example, two Zhang San appear, how do I detect it and change it to Zhang San 1? Zhang San 2

林瑞程
林瑞程

reply all(5)
我从山中来

Lottery system I understand that it is to randomly select one from a pile of data. In this case, why do you use names and mobile phone numbers as the data to be extracted? Then the user corresponding to the extracted mobile phone number is not the only one. , the user name is displayed directly. When designing the user table, add the mobile phone number field to ensure the uniqueness of this field.

  • reply I understand what you mean and have learned from it
    林瑞程 author 2019-12-10 10:41:46
sheitieey

From the data table, the first step should be to ensure how to identify the uniqueness of the data. Only then can we go on.

For example, you said that names can be repeated, so didn’t the Civil Affairs Bureau also come up with *** numbers to solve this problem? They didn't say that if you have this name, just add 1 after your ***

They just told you on the second floor, the mobile phone number can ensure uniqueness

  • reply The problem is that the lottery system only displays usernames and does not display mobile phone numbers. In this way, people cannot tell which username corresponds to which mobile phone number. I am a beginner. Please give me some ideas. Thank you very much for your comments.
    林瑞程 author 2019-12-08 15:14:03
林瑞程

And some people can indeed have the same name, but when they have the same name, I change their names to, for example, Zhang San 1, Zhang San 2... and they are superimposed in this way. It’s not that fields cannot have the same name. They can. We just change it when it does.

卢小强

You can have two fields, username and mobile phone number so there will be no duplication

  • reply But when I query, I only need to use the user name and do not need to use other field data. I still can’t tell the difference?
    林瑞程 author 2019-12-07 21:25:43
Name

Make sure username is unique

  • reply How to achieve it?
    林瑞程 author 2019-12-07 21:24:56
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template