Fatal Errors when DataBase command fails |
Hello all, I'm having a struggle with Fatal Errors being thrown when some of my Databases commands don't return successfully, for example:
Code: $flag = true; In my Database (Postgres) I created an UNIQUE KEY for the column "name". So when I try to insert a name that already exists I would like to get a return of none "affectedRows", and then deal with this return in my function, but when the error occurs, I get a Fatal Error, my request returns instantly with code 500 and an error description that follows: Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: "Type is not supported". in /var/www/html/mysite/system/Format/Exceptions/FormatException.php:9 I could create an SELECT to search for the name before the INSERT, but I'm planning in creating some control in my database using UNIQUE KEYS for a better setup. Thanks in advance |
Messages In This Thread |
Fatal Errors when DataBase command fails - by GuilhermeBiz - 10-18-2019, 07:34 AM
RE: Fatal Errors when DataBase command fails - by titounnes - 10-18-2019, 10:14 AM
RE: Fatal Errors when DataBase command fails - by GuilhermeBiz - 10-18-2019, 10:24 AM
RE: Fatal Errors when DataBase command fails - by kilishan - 10-18-2019, 01:41 PM
RE: Fatal Errors when DataBase command fails - by GuilhermeBiz - 10-18-2019, 02:04 PM
|