Random Music Playlist from DB | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Random Music Playlist from DB

If you can advise some alternative options for creating a random playlist from a database of different musicvideos please feel free to let me know... I thought PHP with mysql would be the easiest way but whats your opinion or ideas ?

28th Jun 2018, 1:06 PM
jackisback
jackisback - avatar
1 Answer
+ 6
Hello, jackisback ! SELECT * FROM `table` ORDER BY RAND () Such a query will pull all the records from the table and mix them randomly. In practice, this is rarely needed. Much more often it is necessary to output exactly a certain number of records: SELECT * FROM `table` ORDER BY RAND () LIMIT 5 And this query already has a practical advantage, because it allows you to output 5 random records. In this way, you can output music from your playlist
28th Jun 2018, 1:11 PM
Alexander Sokolov
Alexander Sokolov - avatar