count_com.php 476 B

12345678910111213141516
  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 COUNT(*) AS count FROM reviews";
  12. $result = $mysql->query($query);
  13. $row = $result->fetch_assoc();
  14. $count = $row['count'];
  15. echo "$count";
  16. ?>