As the title says, i tried to understand the concept but it seems like with it or without it the result its the same. I tried to look into php manual and i kind of understand what says but in practice its just seems the result is the same.
What does setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION) do more exactly?
Asked Answered
Manual also says that
PDO::__construct() throws a PDOException if the attempt to connect to the requested database fails.
This is your case exactly. And it has nothing to do with PDO::ERRMODE_EXCEPTION
.
To test PDO::ERRMODE_EXCEPTION
- properly connect to an existing database and run an invalid query.
Thank you , i tested it on a query with and without setattrib and now i can see the difference . –
Baily
PDO error modes as a reference php.net/manual/en/pdo.error-handling.php –
Aeronautics
© 2022 - 2024 — McMap. All rights reserved.