希望大家都期待周末。:)
我对一些 php/mysql 有轻微的组织重组问题。我有以下一段运行良好的代码:
// Get the regions our user is assigned to look after
$result1 = mysqli_query($con,"SELECT * FROM regions WHERE staff_100_id='$id'");
while ($row1 = mysqli_fetch_assoc($result1)) {
// Now get the claims that have come in for the above regions.
$result2 = mysqli_query($con,"SELECT * FROM registrar_claims WHERE reg_region='$row1[region]' && ready_to_process='yes' ORDER BY claim_id ASC");
while ($row2 = mysqli_fetch_assoc($result2)) {
echo $row2[claim_id] ." ";
echo $row2[reg_1st_name] ." ";
echo $row2[reg_2nd_name] ."<br>";
}
}
}
这个的输出是这样的:
2 Roger Ramjet
7 Snobby Bobgrass
5 Num Nut
6 Phil Pott
我想让输出出来,以便它在整体上由 claim_id 排列,而不仅仅是在 db 调用中的每个周期。所以我希望输出变成:
2 Roger Ramjet
5 Num Nut
6 Phil Pott
7 Snobby Bobgrass
有人愿意向我展示如何重新安排事情以实现这一目标吗?
谢谢,非常感谢!:)
卡斯