On Mar 2, 11:50 pm, krishan <[email protected]> wrote:
> I need to catch this mysql error in advance
> and show a user friendly message for same action.
You could create the "onError" function (takes no parameters) in your
model, which should get called every time there is a DB error of some
kind.
Inside that function you can do something like this to get the last
error number and message (replace 'default' with your DB config name):
$db = ConnectionManager::getDataSource('default');
$err = $db->lastError(); // returns a string in form of: ErrorNumber:
Error Description
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---