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
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.