Forum Moderators: coopster
$result = mysql_query("
SELECT
name AS artist_name
FROM `".$database_table_prefix."artist`
ORDER BY `name` ASC
") or die(mysql_error());
$grid = new grid;
$grid->columns = array(
'Artist' => 'artist_name'
);
Now this pull's the artist's name from the database.
What I would like to do next, is on the output of 'artist_name' is to be able to see the albums listed under that artist.
Ideally, all components should be linkable, album, artist, song
so that if i click on a song, it shows the artist and album its on, or if i click on an album, it shows the artist and what songs are on it.
Kind of a big project eh? would it best suit me to have include files that do all the queries?
1.) Exampl
//current page
www.yoursite.com/index.php?artistId=10
//retrieving artist id
$artistId = $_GET['artistId']; //don't forget to properly clean this variable.
//quering for songs by this artist
$query = "select songId, songName from songs where artistId=$artistId";
//query for albums by artist
$query2 = "select albumId, albumName from album where artistId=$artistId";
//all thats left is to run the query and display the data
I've never played with xml stuff, so i wouldnt know what to do with that portion. but this is one basic way how you would form your queries and display data on your page.