12345678910111213141516171819 |
- <?php
- $host = "provalgk.beget.tech";
- $username = "provalgk_user";
- $password = "Qwer123.";
- $database = "provalgk_user";
- $mysql = new mysqli($host, $username, $password, $database);
- // Проверка соединения
- if($mysql->connect_error){
- die("Ошибка подключения". $mysql->connect_error);
- }
- $query = "SELECT AVG(rating) AS average_value FROM reviews";
- $result = $mysql->query($query);
- $row = $result->fetch_assoc();
- $average = $row['average_value'];
- echo "$average";
- ?>
|