Hi, so ive various number of files and database tables including artist, album and tracks. On the webpage user's can choose and artist, an album then songs or the album to buy. However ive to write code so that when the user selects to buy the album all the tracks are added to the shopping cart.

The file ive to add the code to only has the following in it:



   echo "<p>Going to buy album $albumID</p>";
   echo "<p><a href=\"shopForTracks.php\">Click here to continue</a></p>";


I do have other files with dbquerys etc in it, theres one to get the artist by letter, get album from artist. A shopping, show basket, show purchases,add to basket and checkout files. Not sure if that helps.

6 Years
Discussion Span
Last Post by laura301019

Do do this you will need to add and extra column in the table for the tracks entitiles "album". And then you would need the following PHP/MySQL query or something like it:

$query = mysql_query("SELECT song_id FROM song WHERE album = '".$_POST['album']."'")

$_SESSION['cart_items'] = array();

while($album = mysql_fetch_array($query)
    $_SESSION['cart_items'][] = $album['song_id']
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.