mattennant Posted September 12, 2006 Share Posted September 12, 2006 Hello there i've been struggling with this for a while now and wonder if anyone out there can help me out.I'm trying to create an m3u file to stream music in a kind of radio player. I want the list of mp3's to come from my database music uploads. I've managed to generate the m3u file when manually entering the mp3 paths within a php filesee code below[code]<?header("Content-Type: audio/mpegurl");header("Content-Disposition: attachment; filename=playlist.m3u");print "http://www.myurl.co.uk/nowax/uploads/track1.mp3\r\n";print "http://www.myurl.co.uk/nowax/uploads/track2.mp3\r\n";?>[/code] on the back of this sucess i tried to populate the mp3 paths from the relevent row in the database (see below)[code]<?php require_once('../../connections_handcode/handcode.php'); ?><?phpheader("Content-Type: audio/mpegurl");header("Content-Disposition: attachment; filename=playlist.m3u");$query = "SELECT track_upload FROM music_uploads";$result = @mysql_query ($query);if ($result){while ($row = mysql_fetch_array($result, MYSQL_NUM)){echo'http://www.myurl.co.uk$row[0]'."\n";}}else{echo'error';}?>[/code]I believe, although i'm not certain that the above code, does not put each mp3 on a seperate line as i need to for the generated m3u file. I hope this is something simplethanks in anticipationmatthew Quote Link to comment Share on other sites More sharing options...
mainewoods Posted September 12, 2006 Share Posted September 12, 2006 Your single quotes are what are killing you:[code]echo'http://www.myurl.co.uk$row[0]'."\n";[/code]-$row[0] not translated to value-replace single quotes with double quotes[code]echo "http://www.myurl.co.uk$row[0]" ."\n";[/code] Quote Link to comment Share on other sites More sharing options...
mainewoods Posted September 12, 2006 Share Posted September 12, 2006 you're missing a '/' after '.uk' as well Quote Link to comment Share on other sites More sharing options...
mattennant Posted September 12, 2006 Author Share Posted September 12, 2006 that's the one - thanks so much, i can go to sleep happy now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.