Reputation: 33
I'm a new bee to web development. I need to get data (some columns) from the job
table and filter it according to the user name in the session and a status value (status is a TINYINT there for contains 0 and 1).
Here is my model:
public function show_work() {
$user_name = $this->session->userdata('Name');
$this->load->database();
$this->db->select('jbStageID, Description, StartDate, SpecialDetails, EstimateTime, Instrauctions');
$this->db->where('Name',$user_name);
$this->db->where('status','0');
$rset=$this->db->get('job');
$result=$rset->result_array();
}
Here is my controller:
public function employees()
{
$this->load->model('show_details');
$result= $this->show_details->show_work();
$data = array();
$data['inbox'] = $this->show_details->show_work();
var_dump($result);
echo "<pre>";
print_r($data);
echo "</pre>";
die();
}
The issue is I don't get values from the database but value null with empty array. The result is like this:
Array(
[inbox] =>
)
Upvotes: 2
Views: 104
Reputation: 15603
You need to use the return to return the data as below in the model's last line:
$result=$rset->result_array();
return $result;
Upvotes: 3