A PHP ERROR WAS ENCOUNTERED

A PHP ERROR WAS ENCOUNTERED

Severity: Warning

Message: count(): Parameter must be an array or an object that implements Countable

Filename: controllers/Video.php

Line Number: 20

Backtrace:

File: /home/vol18_1/epizy.com/epiz_29304486/htdocs/application/controllers/Video.php

Line: 20

Function: _error_handler

File: /home/vol18_1/epizy.com/epiz_29304486/htdocs/index.php

Line: 315

Function: require_once

video.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Video extends CI_Controller {

	// Load database
	public function __construct()
	{
		parent::__construct();
		$this->load->model('video_model');
	}

	// Main page video
	public function index()	{
		$site 		= $this->konfigurasi_model->listing();

		// Video dan paginasi
		$this->load->library('pagination');
		$config['base_url'] 		= base_url().'video/index/';
		$config['total_rows'] 		= count($this->video_model->total_video());
		$config['use_page_numbers'] = TRUE;
		$config['num_links'] 		= 5;
		$config['uri_segment'] 		= 3;
		$config['per_page'] 		= 12;
		$config['first_url'] 		= base_url().'video/';
		$this->pagination->initialize($config);
		$page 		= ($this->uri->segment(3)) ? ($this->uri->segment(3) - 1) * $config['per_page'] : 0;
		$video 	= $this->video_model->video($config['per_page'], $page);
		// End paginasi

		$data = array(	'title'		=> 'Video - '.$site->namaweb,
						'deskripsi'	=> 'Video - '.$site->namaweb,
						'keywords'	=> 'Video - '.$site->namaweb,
						'pagin' 	=> $this->pagination->create_links(),
						'video'		=> $video,
						'isi'		=> 'video/list');
		$this->load->view('layout/wrapper', $data, FALSE);
	}

	// Read page video
	public function read($id_video)	{
		$site 		= $this->konfigurasi_model->listing();
		$video 		= $this->video_model->detail($id_video);

		$data = array(	'title'		=> $video->judul,
						'deskripsi'	=> $video->judul,
						'keywords'	=> $video->judul,
						'video'		=> $video,
						'isi'		=> 'video/read');
		$this->load->view('layout/wrapper', $data, FALSE);
	}
}

/* End of file Video.php */
/* Location: ./application/controllers/Video.php */

video_model.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Video_model extends CI_Model {

	public function __construct() {
		$this->load->database();
	}

	// Listing
	public function listing() {
		$this->db->select('*');
		$this->db->from('video');
		$this->db->order_by('urutan','ASC');
		$query = $this->db->get();
		return $query->result();
	}

	// Listing
	public function home() {
		$this->db->select('*');
		$this->db->from('video');
		$this->db->order_by('id_video','DESC');
		$this->db->order_by('urutan','DESC');
		$query = $this->db->get();
		return $query->result();
	}

	// Listing semua
	public function video($limit,$start) {
		$this->db->select('*');
		$this->db->from('video');
		$this->db->limit($limit, $start);
		$this->db->order_by('id_video','DESC');
		$query = $this->db->get();
		return $query->result();
	}

	// Listing semua
	public function total_video() {
		$this->db->select('*');
		$this->db->from('video');
		$this->db->order_by('id_video','DESC');
		$query = $this->db->get();
		return $query->num_rows();
	}

	// Detail
	public function detail($id_video) {
		$this->db->select('*');
		$this->db->from('video');
		$this->db->where('id_video',$id_video);
		$this->db->order_by('id_video','DESC');
		$query = $this->db->get();
		return $query->row();
	}

	// Tambah
	public function tambah($data) {
		$this->db->insert('video',$data);
	}

	// Edit
	public function edit($data) {
		$this->db->where('id_video',$data['id_video']);
		$this->db->update('video',$data);
	}

	// Check delete
	public function check($id_video) {
		$query = $this->db->get_where('produk',array('id_video' => $id_video));
		return $query->num_rows();
	}

	// Delete
	public function delete($data) {
		$this->db->where('id_video',$data['id_video']);
		$this->db->delete('video',$data);
	}
}
avatar abdulrahman_google_6279
@abdulrahman_google_6279

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban