How to pull data out of mysql using php?

There is a table with users, where success - correct and error - incorrect responses of the user.

There is a query that returns a list of users by number of correct answers:

$query = DB::$the->query("SELECT * FROM `users` order by `success` desc, `error` asc LIMIT 10");
while($res = $query->fetch()) {
}


I need something like this, but to display a list of users with sorting, not by the number of correct answers, and their quality - ie took into account the ratio of correct and incorrect answers.

For example, to the user in which 100 correct and 50 incorrect answers was the following list of user 50 is correct, but only 10 wrong answers.
July 2nd 19 at 14:29
1 answer
July 2nd 19 at 14:31
Doesn't help - reva91 commented on July 2nd 19 at 14:34

Find more questions by tags PHPMySQL