MySQL 테이블을 쿼리하여 그 이름 목록을 기반으로 쿼리 목록을 묶은 다음 이름 목록을 가져와야합니다.중첩 된 while 루프가 첫 번째 결과를 건너 뜁니다.
1Bill
2Bob "빌의 이야기"
3Tom "밥의 이야기"
4 : 그것이 내가이 얻을, 출력 할 때
//query the peoples
$query_people = mysql_query("SELECT * FROM people ORDER BY people_name ASC")
while($fetch_people = mysql_fetch_array($query_people)){
$people_id = $fetch_people[people_id];
$people_name = $fetch_people[people_name];
$query_report = mysql_query("SELECT * FROM report WHERE report_entity = '$people_name'");
// output each person's name
echo($people_id.$people_name);
//get their reports
while($fetch_report = mysql_fetch_array($query_report)){
$report_id = $fetch_report[report_id];
$report_type = $fetch_report[report_type];
$report_narr = $fetch_report[report_narr];
echo($report_narr);
}
}
?>
: 여기 내 코드입니다 "Tom 's Narrative"
중첩 루프에서 Bill의 쿼리를 건너 뛰는 이유에 대한 의견이 있으십니까?
아마 테이블 데이터 자체에 문제가 있습니까? – GWW
나는 그렇게 생각하지 않는다 - 나는 다른 방식으로 데이터를 꺼내는 다른 페이지를 가지고 있지만 잘 작동하는 동일한 쿼리를 가지고있다. – thebarless
이상하게 들리면 코드가 소리가납니다. 그러나 어쩌면 나는 뭔가를 놓치고있다. – GWW