I keep table tennis games in mysql database and want to search the database for the top ten persons with most wins. How do I tell php to get the persons int an array?
I have in my database person_a, person_b and result_a, result_b where the result tabs are the numbers of sets the players won in a game. Person_a is always the winner.
"select person_a FROM matches WHERE result_a >= 3 AND result_b < 3";
Does anyone know a simple algorithm for counting the number of times every player is in the result?
Example:
Peter
George
Peter
Peter
George
Simon
Abraham
Simon
Peter
George
should result in Peter 4, George 3, Simon 2, Abraham 1