Create multiple entries


My site needs to record a users entries (can be multiple) then later on down the line select a random entry as a winner. I need help selecting the random winner and can think of two possible solutions, will any of these work and if so, how can they can they be achieved?

Option A)
User clicks ‘enter’, creates a new entry multiple times depending on the number of entries. For example, if the user clicks 3 entries it will need to make 3 new entries in the database for that specific listing. only allows me to create one new row.

Option B)
Assuming the database is set up like below

User, Number of entries, Listing

I need to select a random winner counting whilst counting all of the entries equally. For example, if there are two rows in the above format as per below

Joe Bloggs, 4, A
Andy Davis, 1, A

When selecting a random entry I need to account for 4 of Joe Bloggs entries and 1 of Andy Davis entries. Is this possible?

This topic was automatically closed after 70 days. New replies are no longer allowed.