[eluser]Atrhick[/eluser]
Thank you for correction i fixed those but now im having an error i cant shake again
Error
Code:
Fatal error: Call to a member function employees() on a non-object in
Model
Code:
class Dashboard_model extends CI_Model{
function employees()
{
$query_str = "SELECT * "
. " FROM employees ";
$result = $this->db->query($query_str);
if($result->num_rows() > 0)
{
$employees_list_data= array();
foreach($result->result_array() as $employees_list_results)
{
$employees_list_data[] = $employees_list_results;
}
}
return $employees_list_data;
}
function all_store_comments()
{
$query_str = "SELECT * FROM mail comments";
$result = $this->db->query($query_str);
$all_store_comments = "error I got nothing!";
if($result->num_rows() > 0)
{
$all_store_comments = $result->row();
$all_store_comments = $all_store_comments->all_store_comments;
}
return $all_store_comments;
}
}
Controller
Code:
session_start(); //we need to call PHP's session object to access it through CI
class Dashboard extends CI_Controller {
function index()
{
if($this->session->userdata('logged_in'))
{
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
$data['id'] = $session_data['id'];
$data['store_id'] = $session_data['store_id'];
$data['group'] = $session_data['group'];
$this->load->view('dashboard_view', $data);
$employees_list_data['employees_list_data'] = $this->Dashboard_model->employees();
$this->view_data['employees_list_data'] = $this->Dashboard_model->employees();
$all_store_comments['all_store_comments'] = $this->Dashboard_model->all_store_comments();
$this->view_data['all_store_comments'] = $this->Dashboard_model->all_store_comments();
$this->load->view('dashboard_view', $this->view_data);
}
else{
//If no session, redirect to login page
redirect('login', 'refresh');
}
}
function logout()
{
$this->session->unset_userdata('logged_in');
session_destroy();
redirect('dashboard', 'refresh');
}
}
what you all for the awesome help thus far!