Hello,
Using MySQL I return with mysql_fetch_array an array that is the result of joining three tables. It is a book database and every book that has multiple authors returns mutiple rows, with identical information except for the author.
For display purposes, I only want to return the non-duplicating information once, and gather all the author information into a single output.
In a test script I can eliminate the duplicate ISBN's for example with:
$ISBN_Check = 0;
while ($r = mysql_fetch_array($result)) {
$ISBN = $r["ISBN"];
while ($ISBN != $ISBN_Check) {
echo "$ISBN<br>";
$ISBN_Check = $ISBN; }
}
I have toyed with the embedded while loop but I have been unable to reach a workable result. Is this a common problem (combining rows with common data) and can you suggest a solution?
Many thanks!
Patrick
Patrick Durusau
<!-- e --><a href="mailto[email protected]">[email protected]</a><!-- e -->
Using MySQL I return with mysql_fetch_array an array that is the result of joining three tables. It is a book database and every book that has multiple authors returns mutiple rows, with identical information except for the author.
For display purposes, I only want to return the non-duplicating information once, and gather all the author information into a single output.
In a test script I can eliminate the duplicate ISBN's for example with:
$ISBN_Check = 0;
while ($r = mysql_fetch_array($result)) {
$ISBN = $r["ISBN"];
while ($ISBN != $ISBN_Check) {
echo "$ISBN<br>";
$ISBN_Check = $ISBN; }
}
I have toyed with the embedded while loop but I have been unable to reach a workable result. Is this a common problem (combining rows with common data) and can you suggest a solution?
Many thanks!
Patrick
Patrick Durusau
<!-- e --><a href="mailto[email protected]">[email protected]</a><!-- e -->