pavelazad Posted May 23, 2011 Share Posted May 23, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/237266-mysql-data-on-xml-file-need-help-pls/ Share on other sites More sharing options...
QuickOldCar Posted May 23, 2011 Share Posted May 23, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/237266-mysql-data-on-xml-file-need-help-pls/#findComment-1219292 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.