get number of an image in an album
<p>I am trying to number the images in an album that are shown. Currently in my example (under album_view)
I get 1 of 20 (first image), 1 of 20 (second image), 1 of 20 (third image)... 1 of 20 (last image).</p>

<p>Cannot find a suitable example for this and I am truely stuck. Thanks.</p>

<p>I have the following code:-</p>

<p>album_view.php: This should give 1 of 20 (example), When on the first image in the album. 
                Then 2 of 20, when on the second image and so on
                The last image in the album would be 20 of 20. </p>

<pre><code>&lt;?php 
$count = get_count($artist_id);
foreach ($count as $imgcount) {

echo $imgcount['image_ord']." of ".$imgcount['count'];
} 
?&gt; 
</code></pre>

<p>image_numberof.php: This is my server side code.</p>

<pre><code>&lt;?php
function get_count($artist_id) {
$artist_id = (int)$artist_id;
$count = array();

$count_query = mysql_query("SELECT `image_album_id`, `artist_id`, 
COUNT(`image_album_id`) as `image_count`FROM `album_images`
WHERE `artist_id`=$artist_id AND `member_id`=".$_SESSION['member_id']);

$count_img_row = 1;

While ($count_row = mysql_fetch_assoc($count_query)) {
$count[] = array(
'image_album_id' =&gt; $count_row['image_album_id'],
'artist_id'      =&gt; $count_row['artist_id'],
'count'          =&gt; $count_row['image_count'],
'image_ord'      =&gt; $count_img_row
);

$count_img_row++;
}

return $count;
}
?&gt;
</code></pre>
