Jump to content

Raffle Database


Christiaan

Recommended Posts

Hello Everyone.

 

I have a question. I am building a raffle database. The raffle-tickets will be awarded manually.

Now, I have the following three tables:

 

raf_raffles

------------------------------------

id int(5), primairy, AI

Month varchar(10)

Year Varchar(4)

OpenDate Date

CloseDate Date

 

raf_players

------------------------------------

id int(5), primairy, AI

Badge Varchar(5)

Fname Varchar(32)

Lname Varchar(32)

 

raf_tickets

------------------------------------

id int(5), primairy, AI

month Varchar(12)

year Varchar(4)

badge Varchar(5)

tick_plus int(4)

tick_minus int(4)

 

I have a form that will insert the info into the different tables. The difficulty I am experiencing here is to make sure that the shown data matches.

Person A has x number of tickets for the raffle in November.

Person B has y number of tickets for the raffle in October.

 

Can someone give me some pointers?

I'm new to php so all help is greatly appreciated.

 

Christiaan

Link to comment
Share on other sites

Tickets_plus is where any positive amount of tickets will be inserted into.

Tickets_minus are tickets that will be deducted.

 

Badge is the unique ID-number for each player. So I had put that in there to be able to reference two table.

 

The idea of the raffle is to motivate people performing better. You do good: you get more tickets. You screw up: Tickets will be deducted.

Link to comment
Share on other sites

It's not the number (quantity) of tickets you need in a raffle. You need to know the actual unique ticket numbers/ids held by each person

that's.....a damn good point!

lol I never even looked at it from that angle, all that needs to be in the ticket table is unique id, user id, raffle id (although if you are recycling the raffle tickets for each raffle then obviously this isn't needed either)

Link to comment
Share on other sites

Still not getting how tickets are associated to a raffle, and why not juat have a field that contains the number of tickets that said badge number has and add or subtract from it depending on performance?

Have you ever entered a raffle? 

Link to comment
Share on other sites

Thanks every one.

 

First of all: There are no unique ticket numbers. So that is not a concern. The amount of 'tickets' will be put into a spreadsheet, where each row is a ticket. With the rand() function it will be mixed up.

 

Here is what the intention is: An employee performs good. Get tickets awarded. The employee doesn't perform good: Tickets gets deducted.

I want to do that in a database, so employees can see their number of tickets grow, real time. Can any one help with that?

Link to comment
Share on other sites

I would have two tables. 

 

Employees

employee_id

employee_name (etc etc)

tickets (unsigned int)

 

Transactions

transaction_id

employee_id

manager_id (also an employee, look into normalization if you need to)

transaction_tickets (unsigned int) 

datetime (etc etc)

 

Make sense?

Link to comment
Share on other sites

Yes, makes sense.

 

With this set-up I'm still able to run a search on diffrent months.

I'll just add one more column to the employee table: Line of business. Since I would like to be able to display total of tickets per LOB as well.

Link to comment
Share on other sites

We have 3 lines of business.

Each LOB has a fixed group of employees associated.

For example: LOB A: 15, LOB B: 90 LOB C: 35 LOB D: 2

 

So than that table would be:

ID int(5), Primairy index, auto increment

LOB Varchar(32)

Edited by Christiaan
Link to comment
Share on other sites

I have set this up as tables now:

 

raf_employees:

--------------------

badge

fname

lname

role

tickets

 

raf_lob

---------

id

lob

 

raf_transactions

---------------------

trans_id

badge

manager_badge

trans_tickets

date_time

 

raf_roles

------------

id

role

 

This to make it easier to assign roles to employees.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.