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(); } 
  • because you do not fulfill the request - teran
  • prepare prepares the request, if you pass an error table, it returns false and the catch should work, but for some reason it does not work - DivMan
  • you already decide, or returns false, or an exception. at the same time these actions will not happen. - teran
  • in the documentation, by the way, it says "... or ...". It also says about the emulation mode, in which prepare cannot verify the validity of the request. - teran

0