0
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'];
//這裏我環路結果PHP的MySQL只選擇匹配列
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
只有once.With 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個圖像。只是我不想重複每個圖像的文件夾名稱。我必須將文件夾名稱與文件夾圖像與用戶圖像分組。我的問題是隻爲這些文件夾名稱重複...感謝支持我寫,因爲網站不允許我發佈我的問題'更多的代碼沒有解釋'
感謝您的支持。不起作用 – user1929805 2013-02-16 11:17:20