Skip to content
Advertisement

SQL – How to return a list of data

I have this SQL method below, it is suppose to return multiple rows of data, but it is only returning one item every time I try to display the data.

How do I fix that?

Advertisement

Answer

Inside the while loop in each iteration you change the value of LikeSong, so when the loop ends, LikeSong has the last value assigned to it.
I think that you want a list of arrays returned by your method getLikedSongs() like this:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement