i want to make a function that will send my data from a table to another table. I made it for the first time i sent the data, but i cannot do it twice or more because the ID is duplicated so my database show an error, "Duplicate entry '1' for key 'PRIMARY'"
here is my code:
Controller:
public function verify2($id)
{
$data=$this->welcome_model;
$data->inserts_model($id);
}
public function inserts_model($id)
{
$data=(array)$this;
$query = $this->db->get_where('info', array('note' => 'Suspicious'));
foreach($query->result() as $row){
$this->db->insert('datas',$row);
}
}
Add all fields in select except ID, N try to insert
$this->db->select('title, content, date');
$query = $this->db->get_where('info', array('note' => 'Suspicious'));