You have a wrong statement here,
return $this->db->count_all("jobs");
count_all("jobs")
will give you number of rows in jobs
table.
Replace it with this -
return $this->db->count_all_results("jobs");
Read documentation - http://ellislab.com/codeigniter/user-guide/database/active_record.html
OR an alternative method for count
in ci
,
$this->db->select('COUNT(*) as count');
$this->db->where('`id` NOT IN (SELECT `jobs_id` FROM `jobs_user`)', NULL, FALSE);
$query = $this->db->get('jobs');
$result = $this->db->result($query);
return $result->count;