Welcome Guest, Not a member yet? Register   Sign In
Error - There is no data to update.

I want to do a DB update, but I always get the error message mentioned above: There is no data to update.

My model:

PHP Code:

namespace App\Models;

    use CodeIgniter\Model;

    class EinheitenModel extends Model
    // Table
    protected $table 'einheiten';
    protected $primaryKey 'einh_id';
    // allowed fields to manage
    protected $allowedFields = ['einh_art_id,

My Controller:

PHP Code:
        $this->data['request'] = $this->request;
        $post = [
            'einh_art_id' => $this->request->getPost('einh_art_id'),
            'einh_etg' => $this->request->getPost('einh_etg'),
            'einh_lage' => $this->request->getPost('einh_lage'),
            'einh_qm' => $this->request->getPost('einh_qm'),
            'einh_zimmer' => $this->request->getPost('einh_zimmer'),
            'einh_kueche' => $this->request->getPost('einh_kueche'),
            'einh_bad' => $this->request->getPost('einh_bad'),
            'einh_ebk' => $this->request->getPost('einh_ebk'),
            'einh_badewanne' => $this->request->getPost('einh_badewanne'),
            'einh_dusche' => $this->request->getPost('einh_dusche'),
            'einh_balkon' => $this->request->getPost('einh_balkon')
$save $this->EinheitenModel->where(['einh_id'=>$this->request->getPost('einh_id')])->set($post)->update(); 

Request Variable Post in the error message:
PHP Code:
Key Value
einh_id 1
einh_art_id 6
einh_lage rechts
einh_qm 70
einh_zimmer 3
einh_kueche 1
einh_bad 1
einh_ebk 1
einh_badewanne 1
einh_dusche 1
einh_balkon 1

As you can seeall variables are transferred via postall fields are set in the model under Allowed Fields and a primary key is also transferred
PHP Code:
Can someone give me a hint where else I should look?


Messages In This Thread
Error - There is no data to update. - by Tomasiomat - 03-01-2024, 04:30 AM
The error still occurs! - by Tomasiomat - 03-01-2024, 06:45 AM

Theme © iAndrew 2016 - Forum software by © MyBB