[eluser]london77[/eluser]
Here is how I have done it.
in my model blog_model2.php
Code:
function tPersIncome()
{
$query = $this->db->query("SELECT SUM(amount) AS mnt FROM my_account WHERE inex='Income' and type='Personel' ");
return $query->row();
}
I saw the if i need only a single row, i dont need to use return $query->result();
and in my controller
Code:
public function my_account(){
$data['query'] = $this->blog_model2->myacc_getall();
$data['perinc'] = $this->blog_model2->tPersIncome();
$this->load->view('myaccount_view', $data);
}
and in my view file myaccount_view.php
Code:
<?php
echo '<tr class="bg0">';
echo "<td> Personel </td><td>Income</td>";
echo "<td>". $perinc->mnt ."</td>";
echo "</tr>";
?>
thanks for the great and fast help