Ошибка trying to access array offset on value of type null?

0

Выполняю задание по CodeIgniter (редактирование новости). При нажатии на кнопку "редактировать" появляется такая ошибка: Trying to access array offset on value of type null

Filename: controllers/News.php

Line Number: 60

Backtrace:

File: C:\xampp\htdocs\kinomonster\application\controllers\News.php
Line: 60
Function: _error_handler

File: C:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once

Контроллер News.php

public function edit($slug=Null){
		$data['title']="редактирование новости";
		$data['news_item']=$this->News_model->getNews($slug);

		$data['title_news']=$data['news_item']['title'];
		$data['content_news']=$data['news_item']['text'];
		$data['slug_news']=$data['news_item']['slug'];

		if($this->input->post('slug') && 
			$this->input->post('title') && 
			$this->input->post('text')) {
				$slug=$this->input->post('slug');
				$title=$this->input->post('title');
				$content=$this->input->post('text');

				if($this->News_model->updateNews($slug_news,$title_news,$text_news)) {
					echo "Новость успешно отредактирована!";	
			} 
		} 
				$this->load->view('templates/header', $data);
				$this->load->view('news/edit', $data);
				$this->load->view('templates/footer');			
		
	}

Модель News_model

public function updateNews($slug,$title,$text){
		$data=array(
			'title'=>$title,
			'slug'=>$slug,
			'text'=>$text
		);
		return $this->db->update('news',$data, array('slug'=>$slug));
	}

Не могу понять, что не так?

codeigniter

1 ответов