I did a check for prepare, why if you specify the wrong table, it does not display the message Connection failed?
<?php header('Content-Type: text/html; charset=utf-8'); error_reporting(E_ALL); $user = 'root'; $pass = ''; $dsn = "mysql:host=localhost;dbname=dz;charset=utf8"; try { $pdo = new PDO($dsn, $user, $pass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { echo 'Подключение не удалось: ' . $e->getMessage(); die(); } try{ $statement = $pdo->prepare('SELECT * FROM `boks`'); }catch(PDOException $e){ echo 'Подключение не удалось: ' . $e->getMessage(); die(); }