Hi all,
I have to update the primary key of a model, so I'm forced to use raw SQL. Here's my code:
$DI = \Phalcon\DI::getDefault();
$db = $DI->getShared('db');
$sql = "UPDATE `student` SET `barcode` = ?, `first_name` = ?, `last_name` = ? WHERE `barcode` = ?";
$success = $db->execute($sql,[
$barcode,
$first_name,
$last_name,
$original_barcode
]);
$success
gets set to boolean TRUE or FALSE - which is fine. If it's FALSE I'd like to be able to get the error message. I don't know how, nor can I find documentation on how to get it.