admin.php 502 B

12345678910111213141516171819
  1. <?php
  2. $host = "provalgk.beget.tech";
  3. $username = "provalgk_user";
  4. $password = "Qwer123.";
  5. $database = "provalgk_user";
  6. $mysql = new mysqli($host, $username, $password, $database);
  7. // Проверка соединения
  8. if($mysql->connect_error){
  9. die("Ошибка подключения". $mysql->connect_error);
  10. }
  11. $query = "SELECT AVG(rating) AS average_value FROM reviews";
  12. $result = $mysql->query($query);
  13. $row = $result->fetch_assoc();
  14. $average = $row['average_value'];
  15. echo "$average";
  16. ?>