Jump to content

mysql data on xml file need help pls


pavelazad

Recommended Posts

hello,

 

I need xml file as playlist.xml and i want to retrive data from my mysql table. I have the following code as i am trying to use php code inside playlist.xml file.

<?xml version="1.0" encoding="utf-8"?>

<xml>
<?php

$dbhost='localhost';
$dbuser='pavel';
$dbpass='pavel123';
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("amarmusic");

$sql=("select *from  bband where artist='Meghdol' and album='Drohe Montre Valobasha';");
$res = mysql_query($sql);

while ($result = mysql_fetch_array($res)){
    ?>
        <track>
            <path> <? $result['link']?></path>
            <title><? $result['title']?></title>
        </track>
    <?
}
?>
</xml>

 

but unfortunately its not working. any1 have any idea how to fix it? please help me.

Link to comment
https://forums.phpfreaks.com/topic/237266-mysql-data-on-xml-file-need-help-pls/
Share on other sites

Try not using short tags of <? versus <?php

 

Echo the results, otherwise they will not display.

 

<track>
            <path><?php  echo $result['link'];?></path>
            <title><?php  echo $result['title'];?></title>
</track>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.