I try to do a query, but i don't really know how
my table structure.
artist
artist_name | artist_id
Britney | 1
Nsync | 2
BSB | 3
911 | 4
mixed_song
mixed_song_title |mixed_lyric_id
a mix song-1 | 1
a mix song-2 | 2
mixed_index
artist_id | mixed_lyric_id
2 | 1
3 | 1
4 | 1
1 | 2
2 | 2
3 | 2
And there are thounsand of records like this
I want to know how can I get the output like this format
Artist Name: Nysnc, BSB, 911
Song Title: a mix song-1
Artist Name: Britney, Nsync, BSB
Song Title: a mix song-2
include ('connect.php');
$i=1;
$limit=100;
while($i < $limit):
$query = "SELECT artist.artist_id, artist.artist_name, artist.english_name, artist.gender, artist.region, mixed_song_index.index, mixed_song_index.artist_id, mixed_song_index.mixed_lyric_id, mixed_song.mixed_song_title, mixed_song.mixed_lyric FROM artist RIGHT OUTER JOIN mixed_song ON artist.artist_id = mixed_song_index.artist_id RIGHT OUTER JOIN mixed_song_index ON mixed_song_index.mixed_lyric_id = mixed_song.mixed_lyric_id WHERE mixed_song.mixed_lyric_id = '$i'";
$i++;
endwhile;
$result=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
$artist_id = $row['artist_id'];
$artist_name = $row['artist_name'];
$english_name = $row['english_name'];
$mixed_lyric_id = $row['mixed_lyric_id'];
$mixed_song_title = $row['mixed_song_title'];
$mixed_lyric = $row['mixed_lyric'];
echo "$english_name $artist_name ";
}
echo "Song Title: $mixed_song_title <br><br>";