search

Home  >  Q&A  >  body text

Make a lottery system

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

林瑞程林瑞程1886 days ago1654

reply all(9)I'll reply

  • 我从山中来

    我从山中来2019-12-10 10:39:28

    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
    0
  • 林瑞程

    I understand what you mean and have learned from it

    林瑞程 · 2019-12-10 10:41:46
  • sheitieey

    sheitieey2019-12-08 15:11:17

    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
    0
  • 林瑞程

    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.

    林瑞程 · 2019-12-08 15:14:03
  • 林瑞程

    林瑞程2019-12-07 21:28:02

    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.

    reply
    0
  • 卢小强

    卢小强2019-12-06 16:07:01

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

    reply
    0
  • 林瑞程

    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?

    林瑞程 · 2019-12-07 21:25:43
  • Name

    Name2019-12-06 07:26:52

    Make sure username is unique

    reply
    0
  • 林瑞程

    How to achieve it?

    林瑞程 · 2019-12-07 21:24:56
  • Cancelreply