我希望能够显示专辑中包含的所有图像中的图像数量(每个艺术家一张专辑)。示例:专辑 2,共 10 张。然后转到下一张图片,我们将获得专辑 3,共 10 张,依此类推。我可以通过使用函数get_count然后在我的 HTML 页面上调用该函数和一个foreach语句来获取总数。但是,我不知道如何编写代码来获取个人编号。使用的代码:-
<?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' => $count_row['image_album_id'],
'album' => $count_row['artist_id'],
'count' => $count_row['image_count']
);
}
return $count;
}
?>
<?php
$count = get_count($artist_id);
foreach ($count as $count){
echo '',$count['count'],'';
}
?>