jvsmooth
asked on
creating a playlist using php
hey guys so I have this code thats prints out various aspects of a song and im looking to put these aspects into a playlist with the format
<playlist>
<item>
<filename>'file'<filename/ >
<song>'songname'<song/>
<artist>'artistname'<artis t/>
</item>
</playlist>
include("connectionfile.ph p");
$query = "SELECT id, song_title, song_artist, genre, filepath FROM music ORDER BY song_artist";
$result = mysql_query($query) or die("error in the query");
while ($songs = mysql_fetch_assoc($result) )
{
// THE SONG NAME WILL BE FOUND HERE
$my_id = $songs["id"];
$mysong=$songs["song_title "];
$myartist=$songs["song_art ist"];
$thegenre=$songs["genre"];
$thefilepath=$songs["filep ath"];
echo "<br/>$my_id" . PHP_EOL;
echo "<br />$mysong" . PHP_EOL;
echo "<br/>$myartist" . PHP_EOL;
echo "<br/>$thegenre" . PHP_EOL;
echo "<br/>$thefilepath" . PHP_EOL;
}
thanks for any help guys.
<playlist>
<item>
<filename>'file'<filename/
<song>'songname'<song/>
<artist>'artistname'<artis
</item>
</playlist>
include("connectionfile.ph
$query = "SELECT id, song_title, song_artist, genre, filepath FROM music ORDER BY song_artist";
$result = mysql_query($query) or die("error in the query");
while ($songs = mysql_fetch_assoc($result)
{
// THE SONG NAME WILL BE FOUND HERE
$my_id = $songs["id"];
$mysong=$songs["song_title
$myartist=$songs["song_art
$thegenre=$songs["genre"];
$thefilepath=$songs["filep
echo "<br/>$my_id" . PHP_EOL;
echo "<br />$mysong" . PHP_EOL;
echo "<br/>$myartist" . PHP_EOL;
echo "<br/>$thegenre" . PHP_EOL;
echo "<br/>$thefilepath" . PHP_EOL;
}
thanks for any help guys.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just add it into the echos or replace them?
....
echo "<playlist>"
echo " <item>"
echo "<br/><filename>$thefilepa th<filenam e/>" . PHP_EOL;
echo "<br /><song>$mysong<song/>" . PHP_EOL;
echo "<br/> <artist>$myartist<artist/> " . PHP_EOL;
echo "</playlist>"
echo " </item>"
....
....
echo "<playlist>"
echo " <item>"
echo "<br/><filename>$thefilepa
echo "<br /><song>$mysong<song/>" . PHP_EOL;
echo "<br/> <artist>$myartist<artist/>
echo "</playlist>"
echo " </item>"
....
there's some missing terminators above:
echo "<br/><playlist>";
echo " <br/><item>";
echo "<br/><filename>$thefilepa th<filenam e/>" . PHP_EOL;
echo "<br /><song>$mysong<song/>" . PHP_EOL;
echo "<br/> <artist>$myartist<artist/> " . PHP_EOL;
echo "<br/></playlist>";
echo "<br/> </item>";
echo "<br/><playlist>";
echo " <br/><item>";
echo "<br/><filename>$thefilepa
echo "<br /><song>$mysong<song/>" . PHP_EOL;
echo "<br/> <artist>$myartist<artist/>
echo "<br/></playlist>";
echo "<br/> </item>";
ASKER
phenomenal thank so much
Open in new window