I am using FluentPDO to build my queries.
When I execute an insert statement, it returns False
if it is unable to do so. However, I am unable to figure out how to retrieve the error behind the failure.
Does anyone know how to handle errors while using this library?
This is my current code...
function doInsert() {
$pdo = new PDO("mysql:dbname=blog", "root", "password");
$fpdo = new FluentPDO($pdo);
$values = [
'field1' => 'value 1',
'field2' => 'value 2',
'field3' => 'value 3',
];
$query = $fpdo->insertInto('my_table', $values)->execute();
if (!$query) {
// what to type here to determine error
}
}