1
我有2個表如下:Mysql的循環數據
表1:common_member
+-----------+-----------+
| uid | username |
+-----------+-----------+
| 1 | haha |
| 2 | walao |
| 3 | alamak |
| 4 | hero |
| 5 | theone |
| 6 | nobody |
+-----------+-----------+
表2:labour_slog
+--------------+-------------+--------------+-------------+
| uid | slaveid | masterid | bytime |
+--------------+-------------+--------------+-------------+
| 1 | 2 | 3 | 123456 |
| 4 | 5 | 6 | 456789 |
+--------------+-------------+--------------+-------------+
予取數據如下腳本:
$queryLabourSlog = DB::query("SELECT * FROM ".DB::table('labour_slog')." ORDER BY id desc");
while($rowLabourSlog = DB::fetch($queryLabourSlog)) {
$user_list_slog[] = $rowLabourSlog;
};
array_multisort($idss, SORT_DESC, $user_list_slog);
在我的HTML,我用
<!--{loop $user_list_slog $value}-->{$value[uid]} on {$value[bytime]} forced hire {$value[masterid]}'s employee {$value[slaveid]}.<!--{/loop}-->
的HTML顯示:
1 on 123456 forced hire 3's employee 2.
4 on 456789 forced hire 6's employee 5.
我如何加入Table 1
的用戶名數據得到如下循環顯示?
haha on 123456 forced hire alamak's employee walao.
hero on 456789 forced hire nobody's employee theone.
謝謝。
它的工作原理!非常感謝你!! –
不客氣。 – sfandler