[eluser]TheFuzzy0ne[/eluser]
Code:
if ( ! $code_tags)
{
echo 'Behold the power of the [code] tags!';
}
First of all, how about (Ooh look! Code tags!
):
Model:
Code:
function get_all_topikdo_jumlah()
{
$this->db->select(‘topik_pembimbing1’);
$this->db->select(‘topik_pembimbing2’);
// No point doing this unless we're assigning the number of results to a variable.
$data['total_rows'] = $this->db->count_all_results(‘topik’);
$this->db->from(‘topik’);
$this->db->from(‘dosen’);
$this->db->where(‘dosen_id’,‘topik_pembimbing1’);
$this->db->or_where(‘dosen_id’,‘topik_pembimbing2’);
$data['results'] = $this->db->get()->result();
return $data;
}
$data['jumlah'] is an array of objects, which is why echoing that is causing an error. What is this variable for? I don't understand. If you're expecting it to contain a string, you need to extract that from the database result.
Also, if you're only expecting a single row, it would make sense to limit your query to a single result, and use
result_row() instead of
result()