I have following two function, and I would like to know, is there any way I can combine them into one.
function galerija_get_all(){
$q = $this->db->get('galerija');
return $q = $q->result_array();
}
function galerija_get_all_slike(){
$q = $this->db->get('slike');
return $q = $q->result_array();
}
And in my view file I have this code:
<?php foreach ($galerija as $gal): ?>
<figure>
<?php foreach ($galerija_slike as $img): ?>
<?php if ($gal['id_galerija'] == $img['galerija_id']): ?>
<?php endif ?>
<?php endforeach ?>
<img src="" >
<figcaption></figcaption>
</figure>
<?php endforeach ?>
Is it possible (and if it is, how) this two codes?