I am using SQLite3 in Python and everything is working apart from when I am using RANDOM() and LIMIT. I've searched everywhere and I am pretty sure I am using the correct syntax, and I get no error. Every time I run this, no matter what LIMIT I specify (Or whether it's a fixed or with input) it only displays 1 result. Here is the code:
def RandomPlaylist():
conn = sqlite3.connect("Playlist.db")
c=conn.cursor()
RandomPlaylistLimit = input("How many songs do you want in your playlist [1-100]?")
RandomPlaylistLimitInt = int(RandomPlaylistLimit)
print(RandomPlaylistLimitInt)
if RandomPlaylistLimitInt < 101:
c.execute("SELECT * FROM Songs ORDER BY RANDOM() LIMIT {0}".format(RandomPlaylistLimit))
for row in c.fetchall():
print("""
Song Name: {0}.
Artist: {1}.
Album: {2}.
Length: {3}.
Year: {4}.
""".format(row[1], row[2], row[3], row[5], row[6]))