Jump to content

onthespot

Members
  • Posts

    424
  • Joined

  • Last visited

    Never

Everything posted by onthespot

  1. Yeah was hoping to be able to take away more score from a higher ranked player in the user who wins is lower ranked. And if the high user wins against a lower user, he would receive less points.
  2. This is awesome, really great. Is there a way to take into account both scores, opponent and your own?
  3. How would the points be worked out though? All users start on 500 and when they win against each other, they take an amount of points from each other depending on how high their opponent is ranked.
  4. Thanks for the feedback. I am looking for everyone to start on 500 points. There arent going to be ranks in particular. Just points. So people will get get points for winning and lose points for losing. Users could have say 564, 345, 876, 512 and 643 points. Thats just 5 randoms points totals that would be for 5 different users depending on how well they do. Do you understand what I mean?
  5. I already have all the data stored, I am looking to add the ranking system to it. There is a table with wins draws losses etc in it. Each row is for a different user.
  6. Hello everyone. Before I get started, I want to assure you all that I am not looking for a free pass here and I don't expect anyone to write the code for me. The problem My website is based on football (soccer), and when someone wins a match against their opponent they submit it to the other player to accept and it goes through the system. For my website, I want to create a ranking system based on points. So say everyone starts on 500 points and then depending on who they beat, they take points off one another when submitting a winning result. The higher ranked player you beat, the more points you take. I have no idea where to start with this, could anyone point me in any direction? Give me some ideas about how to develop such a system. Thankyou
  7. Hello all, just a small problem here which im sure someone will have an answer for. When certain users use the messaging system on my site, if they put an apostrophe in ('), they get en error mysql error message. Cant recall the exact message but I assume its because of the character they are trying to enter. Is there any way around this?
  8. I tired where games played rather than home and away seperately. This does work though, thankyou.
  9. <? $fifa09="SELECT `user`, (`home_games_played` + `away_games_played`) AS `games_played`, (((`home_goals_for` + `away_goals_for`)-(`home_goals_against` + `away_goals_against`))/(`home_games_played` + `away_games_played`)) AS `avg_goal_difference` FROM `$tableName` ORDER BY `avg_goal_difference` DESC"; $fifa09stats = mysql_query($fifa09); $i = 0; while($row=mysql_fetch_assoc($fifa09stats)) { if($row['games_played'] >= 5){ ?> <tr> <td><? echo ++$i;?></td> <td><? echo $row['user'];?></td> <td><? echo $row['avg_goal_difference'];?></td> </tr> <? } } ?> Ok so this returns all users that have played 5 games. Problem is that if i add LIMIT 5 on the end, because it needs 5 games, i could end up with less than 5. Obviously this is because it returns the 5 best goal difference rows, but if i then use php to limit to just users that have played 5 games then i will lose some of them and could end up with less than 5 rows returned. Any ideas how i can get around this? thankyou
  10. I want to have a picture, and then have information displayed in certain areas on that picture. I'm going to have a football pitch or soccer pitch some of you may know it as. I then want to have players in the positions and formation, but the player names will be based on php maths. How can I get them to display exactly where I want them to?
  11. <? $archive2="SELECT comp FROM confirmedresults WHERE home_user = '$suser' OR away_user = '$suser'"; $archq2=mysql_query($archive2); while($row=mysql_fetch_assoc($archq2)){ $comp_name2=$row['comp']; } $archive="SELECT * FROM archive WHERE comp_name = '$comp_name2' "; $archq=mysql_query($archive); $num_rows = mysql_num_rows($archq); echo $num_rows; if ($num_rows > 0) { ?> <table cellspacing="10"> <tr> <td>Competition Name</td> <td>Game</td> <td>Format</td> </tr> <? while($row=mysql_fetch_assoc($archq)){ $comp_name=$row['comp_name']; $comp_game=$row['game']; $comp_format=$row['format']; { extract($row); $info = explode("_",$row[comp_name]); ?> <tr> <td><a href="league.php?comp=<? echo $comp_name ?>"><? echo $info[2]; ?></a></td> <td><? echo $comp_game; ?></td> <td><? echo $comp_format; ?></td> </tr> <? } } ?> </table> <? } else { echo "$suser doesn't currently have any archived competitions"; } ?> How can i make the join work on that? I tried and i got no results at all, not even any rows, didnt even echo 0 rows when i tried!
  12. Just thought that was the best way to do it? Could you suggest something else that would actually work?
  13. This would not appear to be an sql problem. So thats why i have placed it in the php forum $archive2="SELECT comp FROM confirmedresults WHERE home_user = '$suser' OR away_user = '$suser'"; $archq2=mysql_query($archive2); while($row=mysql_fetch_assoc($archq2)){ $comp_name2=$row['comp']; } $archive="SELECT * FROM archive WHERE comp_name = '$comp_name2' "; $archq=mysql_query($archive); $num_rows = mysql_num_rows($archq); echo $num_rows; The $num_rows is coming back at 0. I have checked the sql and it works. I have echoed $comp_name2 and that comes back with what i would expect. So somewhere the comp_name = '$comp_name2' isnt working. Its not bringing back what i want. Have you come across anything like this before?
  14. Thankyou ever so much. That has done it. The fullstops i meant by the way in which you joined that together for the variable $tableName. But it works and thankyou
  15. Sorry mate, I understand. I will keep the posts relevant. That reply you just gave me. The table is called fifa09_stats, then fifa10_stats. I have the url of ranking.php?game=fifa09 or ranking.php?game=fifa10 So when i put $game12 as the variable of $_GET['game']; I need the sql to do the $game12 and then add _stats on the end of it. I thought i had this correct but it won't work. Must be the way im doing the sql. Do i need fullstops or extra quotations?
  16. So my final question and have tried several ways of doing this to no avail. I define a variable at the very beginning. $game12=$_GET['game']; I then input this variable into the SQL for the rankings. FROM `$game12_stats` However this doesnt show anything. The variable pulls the correct game from the URL. So when its game=fifa09, it should make the sql , fifa09_stats It doesn't Am i getting something wrong with the syntax for the sql?
  17. Done this, had a error of my own sorry
  18. Sorry i just struggle with things that seem hard to me but are obviously really simple to you. I have tried placing that code everywhere and yet it just wont work.
  19. <table cellspacing="10"> <tr> <td>#</td> <td>User</td> <td>Avg GD</td> </tr> <? $fifa09="SELECT `user`, (`home_games_played` + `away_games_played`) AS `games_played`, (((`home_goals_for` + `away_goals_for`)-(`home_goals_against` + `away_goals_against`))/(`home_games_played` + `away_games_played`)) AS `avg_goal_difference` FROM `fifa09_stats` ORDER BY `avg_goal_difference` DESC"; $fifa09stats = mysql_query($fifa09); $i = 0; while($row=mysql_fetch_assoc($fifa09stats)) { ?> <tr> <td><? echo ++$i;?></td> <td><? echo $row['user'];?></td> <td><? echo $row['avg_goal_difference'];?></td> </tr> <? } ?> </table> How could i alter this code to only display users and their goal difference if they have played at least 5 games? So when adding home and away games played, they must have at least 5 games played? Thankyou
  20. Just realised the slash was th wrong way round
  21. Unexpected character in input: '\' (ASCII=92) state=1 in Thats the error I get with the line you have echoed the average difference on.
  22. Ok so i got the average working. How do i put the 1,2,3,4,5 in? Have no idea how to do this at all.
  23. Well i added the / and then games played into the query, but it returned some silly figures that were just wrong. So i asked you for help!
  24. That worked a treat mate. How could i then modify this to have home_games_played away_games_played added together and divide the goal difference by these to get an average goal difference. Also need to have 1,2,3,4,5 etc as the ranking next to each name. THankyou
×
×
  • 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.