Here is the code block and this results an empty array but I want the result to be zero when it’s like that.
public function step_count($data,$count)
{
$values=array();
for ($i=0; $i < $count ; $i++) {
$query3=$this->db->query("SELECT `check` FROM `staffsalary` WHERE `user_id` = '$data[$i]' AND `month` = '02'");
$result3 = $query3->result();
array_push($values,$results3);
}
return $values;
}
This results an empty array, but i want the result as 0 rather than empty array to show in the view page. How to get the result as 0 when there is no record found in table?