Где ошибка в коде?
0
Здравствуйте. Как-то не выходит найти ошибку в коде, помогите по возможности пожалуйста.
Ошибка:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property 'joy' of non-object
Filename: models/Films_model.php
Line Number: 20
Backtrace:
File: C:\xampp\htdocs\kinomonster\application\models\Films_model.php
Line: 20
Function: _error_handler
File: C:\xampp\htdocs\kinomonster\application\controllers\Movies.php
Line: 13
Function: getFilms
File: C:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
Мой код из Movies:
<?php
defined('BASEPATH') OR exit('No direc script access allowed');
class Movies extends MY_Controller {
public function __construct() {
parent::__construct();
}
public function view($slug = NULL) {
$movie_slug = $this->films_model->getFilms($slug, false, false);
if(empty($movie_slug)) {
show_404();
}
$this->data['title'] = $movie_slug['name'];
$this->load->view('templates/header', $this->data);
$this->load->view('movies/view', $this->data);
$this->load->view('templates/footer');
}
}
Мой код из Films_Model:
<?php
class Films_model extends CI_Model {
public function __construct() {
$this->load->database();
}
public function getFilms($slug = FALSE, $limit, $type = 1) {
if($slug === FALSE) {
$query = $this->db
->where('category_id', $type)
->order_by('add_date', 'desc')
->limit($limit)
->get('movie');
return $query->result_array();
}
$query = $this->db->get_where('movie', array('slug'->$slug));
return $query->row_array();
}
public function getFilmsByRating($limit) {
$query = $this->db
->order_by('rating', 'desc')
->where('category_id', 1)
->where('rating>', 0)
->limit($limit)
->get('movie');
return $query->result_array();
}
}