the problem is caused by the way you are dynamicly setting the recordset in the loop to display the albums.
at line 169 the detail2productsaudio recordset is created using this query:
$query_detail2productsaudio = "SELECT * FROM productsaudio WHERE aid=123456789 ORDER BY productname";
Further down the page in the main recrdset loop, you modify this query to show the song records for the album being displayed. at line 341, it uses this code to accomplish that:
$nested_query_detail2productsaudio = str_replace("123456789", $row_master1album['id'], $query_detail2productsaudio);
well, the problem with this, is that when the add to cart button is pressed, it passes the song iD, and uses that song id to find the coresponding record.
The recordset it uses to look for the sond id is the initial one. but because it is being filtered:
the selected song is not a part of the data returned by the recordset.
The recordset that is used by the add to cart button, needs to return the record that is being added to the cart.