Jump to content

Looping through results


unknown101

Recommended Posts

Hi Guys, I have the following code:

 

while ($row = mysql_fetch_array($match_genres))

			{

				$matching_genres = $row['Artist'];



				$get_artist_ID = $row['Artist_ID']; 


				//Check we have the ID

				echo $get_artist_ID;


				$get_artist_tracks =mysql_query("select Track from track_tbl where Artist_ID='$get_artist_ID'") or die ('Error: '.mysql_error ());



				while ($result = mysql_fetch_array($get_artist_tracks));
				{

				$returned_tracks = $result['Track'];



				echo "$matching_genres<br><p>";



				echo $returned_tracks;

				}

			}

 

Everything works fine until I add in the nested while loop?  If for example I just use $result = mysql_fetch_array($get_artist_tracks); without a loop I get the first row returned from the database no problems.  I then add the loop incase there are other entries with the same "Artist_ID" and attempt to echo them, but it only then prints the artist_ID and $matching_genres ? Can anyone tell me where im going wrong?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/101029-looping-through-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.