Lamez Posted February 26, 2008 Share Posted February 26, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/ Share on other sites More sharing options...
frijole Posted February 26, 2008 Share Posted February 26, 2008 subtract the value they predicted from the final score. The smallest number was closest, and if the number is negative they went over (if that matters) Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477479 Share on other sites More sharing options...
Lamez Posted February 26, 2008 Author Share Posted February 26, 2008 why would I do that? I was thinking, what about a if statement? Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477482 Share on other sites More sharing options...
frijole Posted February 26, 2008 Share Posted February 26, 2008 what is the difference between the total score and the final score? I obviously don't do a lot of sports betting. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477488 Share on other sites More sharing options...
Lamez Posted February 26, 2008 Author Share Posted February 26, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477492 Share on other sites More sharing options...
cooldude832 Posted February 26, 2008 Share Posted February 26, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477494 Share on other sites More sharing options...
Lamez Posted February 26, 2008 Author Share Posted February 26, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477496 Share on other sites More sharing options...
frijole Posted February 26, 2008 Share Posted February 26, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477500 Share on other sites More sharing options...
Lamez Posted February 26, 2008 Author Share Posted February 26, 2008 I don't though the whole system is automatic, except for the admin input on the winners. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477506 Share on other sites More sharing options...
teng84 Posted February 26, 2008 Share Posted February 26, 2008 I believe there's no better way than getting the percentage of each score... over items Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477512 Share on other sites More sharing options...
frijole Posted February 26, 2008 Share Posted February 26, 2008 your system must know who the winners are. So query for the winners, then query for their respective guesses on the final game, and compare them. your function could then attach some value to the member who won and not to the other. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477518 Share on other sites More sharing options...
Lamez Posted February 26, 2008 Author Share Posted February 26, 2008 right I have that, but I am looking at the tie breaker. This will only be used if the two or more users have the same total. Quote Link to comment https://forums.phpfreaks.com/topic/93202-round-function/#findComment-477524 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.