Using Count to get number out of total (ex: 2 of 10, 3 of 10)
<p>I want to be able to show the number of an image out of the total number images contained in an album (one album per artist). Example: Album 2 of 10. Then going to the next image we would get Album 3 of 10 and so on. I can get the total number by using a function <strong>get_count</strong> and then on my HTML page calling the function and a <strong>foreach</strong> statement. However, I do not know how to write the code to get the individual nos. Code used:-</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']);
  While ($count_row = mysql_fetch_assoc($count_query)) {
    $count[] = array(
        'id' =&gt; $count_row['image_album_id'],
        'album' =&gt;  $count_row['artist_id'],
        'count' =&gt; $count_row['image_count']
        );
  }
  return $count;
}
?&gt;

&lt;?php
$count = get_count($artist_id);
foreach ($count as $count){
  echo '',$count['count'],'';
}
?&gt;
</code></pre>
