envms / fluentpdo

A PHP SQL query builder using PDO
http://envms.github.io/fluentpdo/
926 stars 189 forks source link

how check errorInfo #294

Open makhondi opened 5 years ago

makhondi commented 5 years ago

Hi How do I get errors? errorInfo()

$query = $fluent->insertInto('article')->values($values)->execute();

liorphp commented 5 years ago

This is my code:

$fluent->getPdo()->errorCode(); $fluent->getPdo()->errorInfo();

liorphp commented 5 years ago

You can set this option for the PDO : PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION

And simply catch the exception.