[eluser]Atrhick[/eluser]
Guys I have a quick question can you please tell me what I did wrong here.
MODEL:
Code:
class Videoswatchedchart_model extends CI_Model{
function Videoswatchedchart_model(){
parent::__construct();
}
function month_daily_watched_videos()
{
$query_str = " SELECT videos_watched, todaysdate "
." FROM Video_views "
." WHERE MONTH(todaysdate) = MONTH(NOW()) ";
$result = $this->db->query($query_str);
$month_daily_watched= array();
if($result->num_rows() > 0)
{
$month_daily_watched = $result->row();
$month_daily_watched = $month_daily_watched->month_daily_watched;
}
return $month_daily_watched;
}
}
CONTROLER:
Code:
class Videoswatchedchart extends CI_Controller{
function Videoswatchedchart(){
parent::__construct();
$this->view_data['base_url'] = base_url();
}
function index(){
$this->videoswatchedchart_view();
}
function videoswatchedchart_view(){
if ($this->session->userdata('logged_in') !== FALSE)
{
$month_daily_watched['month_daily_watched'] = $this->Videoswatchedchart_model->month_daily_watched_videos();
$this->view_data['month_daily_watched'] = $this->Videoswatchedchart_model->month_daily_watched_videos();
$this->load->view('videos_watched_view', $this->view_data);
}
else
{
$hackerror['hackerror'] = "Please Login Again!";
$this->load->view('login_view', $hackerror);
}
}
}
ERROR:
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$month_daily_watched
Filename: models/videoswatchedchart_model.php
Line Number: 31
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$month_daily_watched
Filename: models/videoswatchedchart_model.php
Line Number: 31