Duplicate record in postgresql from CodeIgniter |
Hi Everyone,
Before I have used mysql, for insert action my code : // in mymodel public function insertData($table, $data) { $res=$this->db->insert($table, $data); return $db_error = $this->db->error(); } // in my controller $result = $this->mymodel->insertData($mytable, $data); if ($result['code'] == 1062){ echo "dublicate" } However now I am using postgresql and it returns error like this: A PHP Error was encountered Severity: Warning Message: pg_query(): Query failed: ERROR: duplicate key value violates unique constraint "user_keywords_keyword_key" DETAIL: Key (keyword)=(fa) already exists. Filename: postgre/postgre_driver.php Line Number: 242 array(2) { ["code"]=> string(0) "" ["message"]=> string(126) "ERROR: duplicate key value violates unique constraint "user_keywords_keyword_key" DETAIL: Key (keyword)=(fa) already exists." } my question is that how to ignore this error
I don't have an answer to your question, but will remind you of the forum guidelines you agreed to at signup, namely that new users have their first few posts moderated. That is why your second, third & fourth post have not shown up yet either, and they will be deleted.
See the link at the top of each subforum ... https://forum.codeigniter.com/misc.php?a...les&fid=24
|
Welcome Guest, Not a member yet? Register Sign In |