Jump to content

Recommended Posts

I am working on a bracket website, and I have a Tiebreaker field. (I told you that to get a better understanding)

 

now the tie breaker is to be used only if some one has the same total score, but say they think the final score will be 50, and the other user thinks it will be 65, but the final score is 70, how would I be able to declare the person that chose 65 as there final score the winner?

 

Also say a person chose 90, and another person chose 95, but the final score was 62, how would I declare the person that chose the score with 90 the winner?

 

So I was guessing I would need to use some kinda round function or something, what do you guys think?

Link to comment
https://forums.phpfreaks.com/topic/93202-round-function/
Share on other sites

ya I am not into sports at all, this is for my dad.

 

The total score is the user score, the points they have made from their picks.

 

The final score is the actually score, it is the team who won the championship score.

 

The Tie breaker is if a user, and another user have the same total score, then it you check to see who is closet to the final score. Even if they have gone over.

Link to comment
https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477492
Share on other sites

let me make a few assumptions

 

1) Your Guesses on final scores are for sports games such as basketball

2) The Guesses are stored in a mysql table called "guesses"

3) The game results are in a secondary table called "game_results" with a primary key called GameID linking to the guesses table

4) There is a users table called "Users" with primary key of UserID used to link it to the guesses table

 

Now how to do it

<?php
$game_id = "10";
$q = "Select Guesses.GuessID as GuessID, game_results.score-Guesses.guess as offset, gusses.guess as guess, Users.Username as username from `guesses`, `game_results`, `users` Where Guesses.GameID = '".$gameid."' and game_results.GameID = '".$gameID."' and users.userid = guesses.guessID GROUP BY game_results.gameID ORDER BY offset ASC";
$r = mysql_query($q) Or die(mysql_error()."<br /><Br />".$q);
$i = 1;
echo "<table border=\"1\"><tr><td>Rank</td><td>Username</td><td>Offest</td></tr>";
while($row = mysql_fetch_assoc($r)){
echo "<tr><td>".$i."</td><td>".$row['username']."</td><td>".$row['offset']."</td></tr>";
$i++;
}
echo "</table>";
?>

 

Now to explain it

 

the query will pull relative data on the game (it has to be done by game in this example)  then it will calculate the offset of the users guess to that games score and order the query by that offset ascending so the least offset is closet.  Then echo it out in a table

 

 

I think that gives u a basic idea to it

Link to comment
https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477494
Share on other sites

No, this is though for a basketball bracket.

 

I have it made a little easier than that.

 

The data (that users guess), go into 6 different tables, sorted by rounds.

 

rnd1

rnd2

rnd3

rnd4

rad5

champ

 

Now the actual winners go into 6 different tables as well.

 

rnd1_win

...

champ_win

 

champ tables are like so:

 

champ_win:

id champ tb

 

and champ:

username champ tb

 

I just am working on the tie breaker script.

Link to comment
https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477496
Share on other sites

ya I am not into sports at all, this is for my dad.

 

The total score is the user score, the points they have made from their picks.

 

The final score is the actually score, it is the team who won the championship score.

 

The Tie breaker is if a user, and another user have the same total score, then it you check to see who is closet to the final score. Even if they have gone over.

 

If you know who the two users are that have gotten the highest scores. you can run a query to find out their guesses on the final game and then subtract those guesses from the actual final score of the game. Then, the user with the smallest number has won.

Link to comment
https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477500
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.