Now it sounds easy but everytime i try to out put it, then it proccess the '<xml>' tags and returns just the info. php code:
<?php
include('connect.php');
connect();
$config['site_base_url'] = 'http://localhost';
$result = mysql_query("SELECT * FROM music");
header("content-type:text/xml;charset=utf-8");
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xml .= "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
$xml .= "<trackList>\n";
while($row = mysql_fetch_assoc($result))
{
$title = $row['name'];
$id = $row['id'];
$url = $row['url'];
$xml .= " <track>\n";
$xml .= " <creator>Music Site</creator>\n";
$xml .= " <title>" . $title . "</title>\n";
$xml .= " <location>" . $config['site_base_url'] . "/musicplayer/". $url . "</location>\n";
$xml .= " </track>\n";
}
$xml .= " </trackList>\n";
$xml .= "</playlist>\n";
echo $xml;
?>
Now instead of getting:
<?xml version='1.0' encoding='UTF-8'?>
<playlist version='1' xmlns='http://xspf.org/ns/0/'>
<trackList>
<track>
<creator>Music site</creator>
<title>Flying to the moon</title>
<location>moon.mp3>
</track>
</tracklist>
</playlist>
I get:
Flying to the moon moon.mp3
As one string.
I am not trying to save a xml file so please don't advise me to do that. Thank you in advance.
<?php
include('connect.php');
connect();
$config['site_base_url'] = 'http://localhost';
$result = mysql_query("SELECT * FROM music");
header("content-type:text/xml;charset=utf-8");
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xml .= "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
$xml .= "<trackList>\n";
while($row = mysql_fetch_assoc($result))
{
$title = $row['name'];
$id = $row['id'];
$url = $row['url'];
$xml .= " <track>\n";
$xml .= " <creator>Music Site</creator>\n";
$xml .= " <title>" . $title . "</title>\n";
$xml .= " <location>" . $config['site_base_url'] . "/musicplayer/". $url . "</location>\n";
$xml .= " </track>\n";
}
$xml .= " </trackList>\n";
$xml .= "</playlist>\n";
echo $xml;
?>
Now instead of getting:
<?xml version='1.0' encoding='UTF-8'?>
<playlist version='1' xmlns='http://xspf.org/ns/0/'>
<trackList>
<track>
<creator>Music site</creator>
<title>Flying to the moon</title>
<location>moon.mp3>
</track>
</tracklist>
</playlist>
I get:
Flying to the moon moon.mp3
As one string.
I am not trying to save a xml file so please don't advise me to do that. Thank you in advance.