0

I am trying to delete a row from the database and, it gives me an error in codeigniter... enter image description here

Here is my code...

public function deletePersonDetailsSingle($id){

    $this->db->where('id', $id);
    $this->db->delete('personhistories');

}

can you please help?

I have written two extra tables to store data and created two triggers for those tables. Here, two extra tables id's were not auto increment

*Note: I have already made my id in "personhistories" auto increment and unique

Hakik Zaman
  • 175
  • 15
  • Possible duplicate of [MySQL 1062 - Duplicate entry '0' for key 'PRIMARY'](http://stackoverflow.com/questions/12179770/mysql-1062-duplicate-entry-0-for-key-primary) – shaggy Apr 20 '17 at 15:59

1 Answers1

0

I wrote two trigger for my database. I used two extra tables "persons_audit" and "personhistories_audit" to store deleted data from "persons" and "personhistories". In those audit tables, PRIMARY KEY's were not auto increment. That's the reason of this error.

Hakik Zaman
  • 175
  • 15