Hallo!
Here is a little tricky script:
<?php
mysql_connect ("localhost", "", "");
mysql_select_db ("books");
$select = "
SELECT
a.name AS author,
b.name AS book,
a.id AS author_id,
b.name AS book_id
FROM
author AS a,
book AS b,
book_author AS ba
WHERE
a.id = ba.author_id
AND
b.id = ba.book_id
";
$query = mysql_query ("$select") or die (mysql_error());
echo "<table border=1>";
while ($row = mysql_fetch_array ($query)) {
echo "<tr><td>" . $row[0] . "</td><td>" . $row[1] . "</td></tr>";
}
echo "</table>";
?>
This output:
Brad Phillips - MySQL in a bucket
Don Charles - MySQL in a bucket
Bob Silver - Databases for Delinquents
Brad Phillips - PHP Professional
Brad Phillips - Design Patterns
How can I sort output like this:
Brad Phillips - MySQL in a bucket , PHP Professional, Design Patterns
Don Charles - MySQL in a bucket
Bob Silver - Databases for Delinquents
Thanks!