使用此代码:
$query = "select users.id_user, users.full_name, users.rights, users.group, group.id, group.name
from users
inner join group
on users.group=group.id
where users.rights= 2";
// connection code
while ($re = mysql_fetch_array($res))
{
$id_user = $re["id_user"];
$id_group = $re["id"];
$full_name= $re["full_name"];
$group_name= $re["name"];
echo "<div>";
echo "<p><strong>$group_name</strong></p>";
echo "$full_name<br />";
echo "</div>";
}
?>
我明白了:
组 1
用户 1
组 1
用户 2
组 2
用户 3
组 2
用户 4
我需要这样的:
组 1
用户 1
用户
2
组 2
用户 3
用户 4
如何只显示一次组名?