Populate jPlayer playlist from MySQL database

PHP sample code how to populate a jPlayer playlist from a MySQL database.
Author: Jason Price: Free GPLv2 Type: PHP,MySQL

To populate a jPlayer playlist from a MySQL database you can use the following sample code. You need to have jQuery and jPlayer loaded.

STEP 1

Insert the following PHP code before placement of the playlist HTML. The while loop extracts the wanted records from the database and builds up the playlist as a Json array.

Click in textarea to select code then copy and paste Ctrl-CCtrl-V

STEP 2

Now you can activate the player with the playlist data ready to go. Copy and paste the jQuery script code after the above PHP code. For more details on jPlayer configuration parameters, visit the jPlayer Web site.

Click in textarea to select code then copy and paste Ctrl-CCtrl-V

STEP 3

Copy and paste the jPlayer HTML code after the above jQuery code. Don't forget to have the jPlayer CSS stylesheet loaded and adjust this as is desired.

Click in textarea to select code then copy and paste Ctrl-CCtrl-V


Want to donate a little to SimplytheBest.net?