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