Jump to content

Point Scoring System


Medicine

Recommended Posts

I'm creating a KIND OF fantasy betting script, but instead of money, users get points, and are ranked by how many points. It's based on MMA so the betting would go like so. . .

 

Pick the Winner of the fight

Pick the Method of victory

Pick the Round they will win in.

 

So, I can code the basic stuff i.e users picking the above results, but I don't know how to code so I (Admin) can add results, then when results are added, users that pick correct, Gain points.

 

ANY Help would be appreciated.

 

Thanks

Link to comment
Share on other sites

you will need to create a user management system, with different access levels. you will need to create a page for members to view the up  coming fights. a page with information about each fight. a page where they can vote bet on a fight. .. and thats just to start.

 

;)

Link to comment
Share on other sites

I've created a page for the upcoming events, fights, info on fights & and a page where they can choose the outcome etc. I just need to create the part where I can enter the winner, what round & method, and with doing that, the people who predicted it correctly gain X amount of points.

 

So I have for example. . .

 

Anderson Silva Vs Chael Sonnen

 

To Win:

Chael Sonnen  (Radio Button)

Anderson SIlva (Radio Button)

 

Method:

KO (Radio Button)

TKO (Radio Button)

Submission (Radio Button)

Decision (Radio Button)

 

Round:

1 (Radio Button)

2 (Radio Button)

3 (Radio Button)

4 (Radio Button)

5 (Radio Button)

 

When a user picks each of the above, it sends it to the picks in the database. I just need to create what I stated above now.

 

(I am same person, Just managed to find my main account on here).

 

Thanks BTW.

Link to comment
Share on other sites

Just so it's clear, I have EVERYTHING apart from what I've requested. I have homepage, Users register/login, through to main page, Then menu for Upcoming events, Fights, Fights Info, Your Picks etc. I just need the back-end coding for when users select their picks, I need to be able to (after the event) enter the results and when the results are entered and final, whomever chose the correct results, gains points.

 

Thanks alot

Link to comment
Share on other sites

Robert answered your question, it's really the way to go for this type of setup. If you are asking for someone to write all the scripts for your back-end administration area then you'd have to look at the freelance section of the forum. If you have some code you've come up with and are looking for help fixing it then we'd all be pretty happy to help you out.

 

Setup a field in your database for admin flag 0 or 1.

Make each script check it or store it in a session for a quick check, encode it or do whatever to secure it.

Then make your forms and db features for altering events.

Link to comment
Share on other sites

I've already done what Robert suggested. I have back-end Admin, I just don't know what the best way to go about coding it so that when I enter the results of events, it adds points to whomever chose correct fighters etc.

 

I'm not asking for code, just the best WAY.

Link to comment
Share on other sites

So in my DB, I have Events table, Which has Name - Fight 1 - Fight 2. . . and so on.

 

When I enter the results back-end, would it be something like "if $userpick = $winner

UPDATE $userpoints+10"

 

Not clean code obviously, just along the lines. .

 

Thanks again

Link to comment
Share on other sites

I think maybe I'll change DB so that the events table is more like. .

 

Username - Pick 1 - Pick1 Method - Pick1 Round - Pick1 Winner - Pick1 W Method - Pick1 W Method

 

I wanted to keep the DB not massive though.

 

I'm sure I'll figure it.

 

Thanks

Link to comment
Share on other sites

<?php 

// Connect to the database and establish values for Aurtua bonus.
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
// 

$increment=10; 
$fields = Array("points"); 
// 

foreach ($fields as $fld) {  

$query = "update table set $fld=($fld+$increment) where winner = 'fighter1'";  
mysqli_query($dbc, $query) or die("cannot execute: ". mysql_error()); 
echo "completed";
}  
mysqli_close($dbc);

?> 

 

You'd have to enter your connection information, adjust the table name and the winner to match the correct name, but that's workable. You could also alter it to take input from a field from a form that you'd have access to, and just type the winner name and run the script to step over all the fields and reward the winners.

Link to comment
Share on other sites

I've already done what Robert suggested. I have back-end Admin, I just don't know what the best way to go about coding it so that when I enter the results of events, it adds points to whomever chose correct fighters etc.

 

I'm not asking for code, just the best WAY.

You're going to need several tables here.

 

Table 1: Users table.  This identifies each of your users and what makes them individual

Table 2: Match table.  This is where you create matches for your users to 'bet' on.  This table will have things like a unique id, the opponents, date/time, and whatever options the users can bet against.  Based on this table, your users are able to opt for their choices.  These choices are stored in the next table.

Table 3: Betting table.  This correlates a user's id with a match id and their bet.

 

With all of that information, you will write your functions to run the results through when you go back and finalize the match.  Based on the function's results, you can update the user's table with their points gained / lossed.

Link to comment
Share on other sites

I think that's what I was missing, the Betting table, I have User table & Match (Event) table, I think I just need to add the Betting table! I'm just struggling on how to layout the table in terms of picks, because for each event there is 10+ picks. I didn't wanna over complicate things.

 

Thanks :)

Link to comment
Share on other sites

I think that's what I was missing, the Betting table, I have User table & Match (Event) table, I think I just need to add the Betting table! I'm just struggling on how to layout the table in terms of picks, because for each event there is 10+ picks. I didn't wanna over complicate things.

 

Thanks :)

Based on this:

Anderson Silva Vs Chael Sonnen

 

To Win:

Chael Sonnen  (Radio Button)

Anderson SIlva (Radio Button)

 

Method:

KO (Radio Button)

TKO (Radio Button)

Submission (Radio Button)

Decision (Radio Button)

 

Round:

1 (Radio Button)

2 (Radio Button)

3 (Radio Button)

4 (Radio Button)

5 (Radio Button)

 

If this betting formula is a static method, then you would have a fairly simple table.

 

Betting Table

| bet_id | match_id | user_id | fighter_id | method | round

 

Betting Form

<input type=hidden value=1 name=match_id />

<input type=radio name=fighter value=1>Sonnen

<input type=radio name=fighter value=2>Silva

 

<select name=method><option value=1>KO</option><option value=2>TKO</option> ...

 

<input type=text name=round placeholder=round />

 

So user 'John' with id 12 would select: Silva (duh!), TKO, 3

 

 

Betting Table

| bet_id | match_id | user_id | fighter_id | method | round

|    1    |      1      |    12      |      2      |      2      |    3

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.