I have this code:
<?php foreach ($galerije as $gal): ?>
<h1><?php echo str_replace('_', ' ', $gal['naziv']) ?></h1>
<p><?php echo word_limiter($gal['opis'], 30) ?></p>
<?php echo count($slike) ?>
<hr>
<?php endforeach ?>
$galerija represent all the galleries in the DB and have id_galerija as the primary key.
$slike represent all the images in the DB and they have one to many relationship with galerija (one gallery can have many images). It is connected with galerija_id (slike.galerija_id = galerija.id_galerija). How can I count number of images for every gallery?
You could do it like this:
Which would end up with:
Is that what you wanted?