消息:尝试使用 CodeIgniter Framework 获取非对象的 属性

Message: Trying to get property of non-object using CodeIgniter Framework

 case "up":
    $current_row = $this -> crud_model -> get('client_list', array('id_client_list' => $entry_id), 'id_client_list', 'asc', '1');
    $affected_row = $this -> crud_model -> get('client_list', array('id_company' => $current_row -> id_company, 'ord' => $current_row -> ord - 1), 'id_client_list', 'asc', '1');
    $this -> crud_model -> save('client_list', array('id_client_list' => $current_row -> id_client_list), array('ord' => $affected_row -> ord));
    $this -> crud_model -> save('client_list', array('id_client_list' => $affected_row -> id_client_list), array('ord' => $current_row -> ord));

我收到这个错误:

Message: Trying to get property of non-object

据我所知,这是建立在一个框架之上的,这使得它更难理解。

错误发生在最后两行。这是一个框架无法做到这一点还是代码错误?

您没有退回任何东西。

$current_row = $this->crud_model->get('client_list', array('id_client_list' => $entry_id), 'id_client_list', 'asc', '1')->row();
$affected_row = $this->crud_model->get('client_list', array('id_company' => $current_row->id_company, 'ord' => $current_row->ord - 1), 'id_client_list', 'asc', '1')->row();
$this->crud_model->save('client_list', array('id_client_list' => $current_row->id_client_list), array('ord' => $affected_row->ord));
$this->crud_model->save('client_list', array('id_client_list' => $affected_row->id_client_list), array('ord' => $current_row->ord));

在最后添加->row();