At the entrance we get a GET of the form localhost / stat.php? C = Russia. It is necessary through a request to the database to find out who "owns" the country. Ie the value of the country in the field is greater than or equal to 1. Next, output the nick-name of the "owner" and the numeric value in the field separated by a space. If the value is 0, output "not found". To clarify, the value can be positive in only one field. The presence of sql injection vulnerability does not matter. I myself, of course, tried it, but the result could not be obtained.
I would be very grateful for the code. That's what I have.
<?php $country = $_GET['c']; // данные доступа к базе данных $db_host="localhost"; // обычно не нужно изменять $db_user="??"; // имя пользователя БД $db_password="??"; // пароль БД $db_name = "??"; // имя БД $mysqli = new mysqli($db_host, $db_user, $db_password, $db_name); if (mysqli_connect_errno()) { printf("Ошибка соединения: %s\n", mysqli_connect_error()); exit; } $mysqli->set_charset("utf8"); // Выполняем запрос: выбрать пользователей, которые посетили приложение более 10 раз if ($stmt = $mysqli->query('SELECT * FROM `users` WHERE `$country`>0')) { // выводим данные while($row = $stmt->fetch_assoc()){ echo $row['nickname'].' '.$row['$country'].'<br />'; } } 