Mysql Database-
id | username | folder_name |
1 | ashly | Folder |
2 | ashly | |
3 | ashly | |
4 | ashly | Folder |
5 | ashly | Folder |
6 | ashly | Folder 1 |
7 | ashly | Folder 2 |
$sql = mysql_query("SELECT `id`, `username`, `title`, LEFT(`description`, 90) as `description`, `file`, `code`, `folder_name`, `type`, `size`, `date` FROM `files` WHERE `username` = '$userfile' AND `folder_name` > '' ORDER BY `id` DESC LIMIT 1, 5");
while ($query_row = mysql_fetch_array($sql2)) {
$filefolder = $query_row['folder_name'];
$filetitle = $query_row['title'];
$filecode = $query_row['code'];
$filedesc = $query_row['description'];
$filefile = $query_row['file'];
$filesize = $query_row['size'];
$filedate = $query_row['date'];
$filetype = $query_row['type'];
// ここで結果をループします
if (empty($filefolder) === false) {
echo "" . $filefolder . "<div id='imageshowsearch'><div id='linkstyle'><strong><a href='http://localhost/edu/1111111111111/userdownload.php?code=". $filecode . " '><img src='files/thumbs/" . $filecode . "/" . $filefile . "' alt=" . $filetitle . ">" . $filetitle . "</strong></div></a></div>";
//here print result
}
}
folder_name
フォルダから 5 枚の画像を表示します。| mysqlの結果をループするとき。
Result:
folder | folder | folder | folder 1 | folder 2
here is image | here is image | here is image | here is image | here is image
I wonna get this result:
folder |
here is image | here is image | here is image |
folder 1 |
here is image |
folder 2 |
here is image |
アイデアがありません。フォルダー名を一度だけ表示し、フォルダー名の下にあるフォルダーから最大 5 つの画像を表示する方法。ただ、すべての画像でフォルダ名を繰り返すつもりはありません。フォルダー名とフォルダー イメージをユーザー イメージとグループ化する必要があります。私の問題は、これらのフォルダー名の繰り返しのみです...サポートに感謝します。ウェブサイトで質問「詳細コード説明なし」を公開できないため、書いています