tutorials:other:online_playlist_on_your_website_with_php_mysql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:other:online_playlist_on_your_website_with_php_mysql [2014/08/14 09:33] – [Setting up mAirList HTTP Logging] tw | tutorials:other:online_playlist_on_your_website_with_php_mysql [2021/06/18 06:40] (current) – Version ohne Datenbank tw | ||
---|---|---|---|
Line 74: | Line 74: | ||
Now run mAirList, start a couple of songs and watch how the '' | Now run mAirList, start a couple of songs and watch how the '' | ||
===== Retrieving the Data ===== | ===== Retrieving the Data ===== | ||
+ | |||
+ | Once the data is in the '' | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | $db = mysqli_connect(' | ||
+ | |||
+ | $res = mysqli_query($db, | ||
+ | |||
+ | print "< | ||
+ | while (list ($starttime, | ||
+ | print "< | ||
+ | } | ||
+ | mysqli_free_result($res); | ||
+ | print "</ | ||
+ | </ | ||
+ | |||
+ | As all entries are stored along with the date/time the song was started, it is also possible to implement a search function that looks up the songs played in a given time frame. | ||
+ | |||
+ | ====== Alternative Version without MySQL ====== | ||
+ | |||
+ | Here's a simple alternative version of the approach that does not use a database but only stores the current artist/ | ||
+ | |||
+ | inject.php: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | $handle = fopen('/ | ||
+ | fwrite($handle, | ||
+ | fwrite($handle, | ||
+ | fclose($handle); | ||
+ | |||
+ | print " | ||
+ | </ | ||
+ | |||
+ | nowplaying.php: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | $handle = fopen('/ | ||
+ | $artist = fgets($handle); | ||
+ | $title = fgets($handle); | ||
+ | fclose($handle); | ||
+ | |||
+ | print "Now playing: $artist - $title"; | ||
+ | </ | ||
tutorials/other/online_playlist_on_your_website_with_php_mysql.1408008835.txt.gz · Last modified: 2019/07/09 16:19 (external edit)