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
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.
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
replyThe 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.
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.
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.
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
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
Make sure username is unique