Welcome Guest, Not a member yet? Register   Sign In
catch db errors before returning back to controller
#1

[eluser]smash120[/eluser]
I have an update form which I am using to update info in my database.
The account_ num is a primary key but it can be updated if user enters it wrong. I tried using
Code:
$this->form_validation->set_rules('acc_num','Account Number','trim|required|is_unique[patient_info.account_num]|xss_clean');
But using this it will not let me update the field. So I removed the line, but when it get to the update part of my code codeigniter redirects me to a page which displays this info
Code:
Error Number: 1062

Duplicate entry '2' for key 'PRIMARY'

UPDATE `ci_patient_info` SET `account_num` = '2', `dob` = '12-12-1955', `sex` = 'Male' WHERE `account_num` = 1

Filename: C:\wamp\www\drz\sys\database\DB_driver.php

Line Number: 330
How would I catch this error so I can display my own error message in the view page


Messages In This Thread
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:32 AM
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:42 AM
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:56 AM
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB