vienmer-iesacejs Posted November 12, 2011 Report Share Posted November 12, 2011 Tātad ir uztaisīts pavisam vienkāršs php skripts, kas uzģenerē .m3u playlist failu izmantojot datubāzi, bet lieta tāda, ka man viņš visu saliek vienā rindiņā. #EXTM3U #EXTINF: 1, nosaukums http://manaadrese.com/fails Kā lai ieliek atstarpes, lai izskatītos šādi: #EXTM3U #EXTINF: 1, nosaukums http:/manaadrese.com/fails Rekur daļa no mana skripta... $sql="SELECT * FROM tracks"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { //generating playlist $livePlaylist .= '#EXTM3U'; $livePlaylist .= '#EXTINF: '.$row['nr'].', '.$row['name'].''; $livePlaylist .= ''.$url.''; } header("Content-type: application/m3u;\n"); header("Content-Transfer-Encoding: binary"); $outname=$q.'.m3u'; header("Content-Disposition: attachment; filename=\"$outname\";\n\n"); echo $livePlaylist; Quote Link to comment Share on other sites More sharing options...
Sasa Posted November 12, 2011 Report Share Posted November 12, 2011 (edited) while($row = mysql_fetch_array($result)) { //generating playlist $livePlaylist .= '#EXTM3U\n\n'; $livePlaylist .= '#EXTINF: '.$row['nr'].', '.$row['name'].'\n'; $livePlaylist .= ''.$url.''; } \n - vajadzētu pārnest nākamo rakstāmo rindiņu jaunā rindā. Edited November 12, 2011 by Sasa Quote Link to comment Share on other sites More sharing options...
nikidijs Posted November 12, 2011 Report Share Posted November 12, 2011 @Sasa - nē, šitie \n te laikam nedarbosies. @vienmer-iesacejs - A tu paņem un truli ar ENTER'u saregulē kā vajag. Tipa: while($row = mysql_fetch_array($result)) { //generating playlist $livePlaylist .= '#EXTM3U '; $livePlaylist .= '#EXTINF: '.$row['nr'].', '.$row['name'].' '; $livePlaylist .= ''.$url.' '; } Quote Link to comment Share on other sites More sharing options...
vienmer-iesacejs Posted November 12, 2011 Author Report Share Posted November 12, 2011 Viss kārtība problēma atrisināta! Quote Link to comment Share on other sites More sharing options...
nemakuphp Posted November 12, 2011 Report Share Posted November 12, 2011 $sql="SELECT * FROM tracks"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { //generating playlist $livePlaylist .= '#EXTM3U'.PHP_EOL; $livePlaylist .= '#EXTINF: '.$row['nr'].', '.$row['name'].PHP_EOL; $livePlaylist .= $url.PHP_EOL; } header("Content-type: application/m3u;\n"); header("Content-Transfer-Encoding: binary"); $outname=$q.'.m3u'; header("Content-Disposition: attachment; filename=\"$outname\";\n\n"); echo $livePlaylist; Quote Link to comment Share on other sites More sharing options...
briedis Posted November 12, 2011 Report Share Posted November 12, 2011 Tāpēc, ka ir atšķirība starp '\n' un "\n" tieši tāda pati, kā starp '$a' un "$a". Drīkst, protams, arī šitā: $ = "teksts jauna rinda"; Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 12, 2011 Report Share Posted November 12, 2011 Kāpēc briedis vienmēr pirmais paspēj pateikt pareizo atbildi? :( Es arī zināju! :D 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.