Update:
When "$model->save" is used the problem occurs exactly as described above; if the option is $model->insert with or without the primary key, the error message occurs but the table is updated.
Controller:
Code:
public function artrec() {
helper('form');
$model = new PlayersAlbumsModel();
$header = array (
'icon' => 'codeigniter',
'css' => '',
'title' => 'Atualização da tabela \'player_albuns\' - wdeda',
'action' => '/ci4/search/allmedia/',
'placeholder' => 'Pesquisar'
);
$rules = [
'player_id' => 'required',
'album_id' => 'required'
];
if ($this->validate($rules)) {
$model->insert([
'player_id' => $this->request->getVar('player_id'),
'album_id' => $this->request->getVar('album_id'),
'pick' => $this->request->getVar('pick')
]);
echo view('templates/headerx', $header);
echo view('utils/artec');
echo view('templates/footerfb');
} else {
echo view('templates/headerx', $header);
echo view('utils/artrec');
echo view('templates/footerfb');
}
}
Attached Files
insert with pkey off - update done.pdf (Size: 107.63 KB / Downloads: 3)
insert with pkey on - update done.pdf (Size: 107.79 KB / Downloads: 2)