[eluser]developer10[/eluser]
[quote author="John_Betong" date="1285659669"]Play about with this:
Code:
// in you Model
if ($query->num_rows() > 0)
{
$projekti = $query->result_array();
foreach ($projekti as $row)
{
$broj = $this->db->count_all_results('job_ponude', array('pro_id' => $row['pro_id']));
// Debug: remove rem on next line to see the count_all_result()
// echo '<br />' .$broj;
$data['broj'][] = $broj;
}
// in you View
foreach($broj as $detail => $row):
echo '<br />details: ', $detail;
echo '<br />row: ', $row;
endforeach;
[/quote]
I tried your code but still not getting the counted value.
Variable $data should carry to view both $projekti variable and counted variable. So, how to merge these values into $data:
Code:
$data = $projekti // from main query (main rows)
$data = /* counted value from foreach loop inside the model */
$data['broj'][] = $broj; // this was your example but it seems not to work :(
Thanks for trying though. Hope something else crosses your ming, or way to work this out?