Я пытаюсь создать функцию обновления, но она выдает ошибку, не знаю почему.
Вот моя модель
public function update_news($id = 0)
{
$this->load->helper('url');
$slug = url_title($this->input->post('title'), 'dash', TRUE);
$data = array(
'title' => $this->input->post('title'),
'text' => $this->input->post('text')
);
$this->db->where('id', $id);
return $this->db->update('news', $data);
}
Контроллер:
public function update($id)
{
$this->load->helper('form');
$this->load->library('form_validation');
$data['title'] = 'Editar noticia';
$this->form_validation->set_rules('title', 'Title', 'required');
$this->form_validation->set_rules('text', 'Text', 'required');
if ($this->form_validation->run() === false) {
$this->load->view('templates/header', $data);
$this->load->view('news/update');
$this->load->view('templates/footer');
} else {
$this->news_model->update_news($id);
$this->load->view('news/success');
}
}
Просмотр
[url=
Подробнее здесь: https://stackoverflow.com/questions/435 ... odeigniter