Guest User

XML PHP

a guest
Dec 17th, 2012
157
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sql  = @mysql_query("SELECT musica, descricao FROM musica");
  2. $row = mysql_num_rows($sql);
  3. if($row > 0) {
  4.  
  5.                 $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
  6.                 $xml .= "<config>";
  7.                 $xml .= "<param name=\"height\" value=\"150\" />";
  8.                 $xml .= "<param name=\"width\" value=\"250\" />";
  9.                 $xml .= "<param name=\"bgcolor\" value=\"cccc99\" />";
  10.                 $xml .= "<param name=\"bgcolor1\" value=\"e79a2d\" />";
  11.                 $xml .= "<param name=\"bgcolor2\" value=\"d38c29\" />";
  12.                 $xml .= "<param name=\"buttoncolor\" value=\"dddddd\" />";
  13.                 $xml .= "<param name=\"buttonovercolor\" value=\"f9bf37\" />";
  14.                 $xml .= "<param name=\"slidercolor1\" value=\"dddddd\" />";
  15.                 $xml .= "<param name=\"slidercolor2\" value=\"cccccc\" />";
  16.                 $xml .= "<param name=\"sliderovercolor\" value=\"f9bf37\" />";
  17.                 $xml .= "<param name=\"textcolor\" value=\"dddddd\" />";
  18.                 $xml .= "<param name=\"playlistcolor\" value=\"999999\" />";
  19.                 $xml .= "<param name=\"currentmp3color\" value=\"f9bf37\" />";
  20.                 $xml .= "<param name=\"scrollbarcolor\" value=\"cccccc\" />";
  21.                 $xml .= "<param name=\"scrollbarovercolor\" value=\"f9bf37\" />";
  22.                 $xml .= "<param name=\"showvolume\" value=\"1\" />";
  23.                 $xml .= "<param name=\"showinfo\" value=\"1\" />";
  24.        
  25.  
  26.                 for($i=0; $i<$row; $i++) {
  27.                  
  28.                   $musica   = mysql_result($sql,$i,"musica");
  29.                   $descricao= mysql_result($sql,$i,"descricao");
  30.    
  31.                     $xml .= "<param name=\"mp3\" value=\"$musica|\" />";
  32.                     $xml .= "<param name=\"title\" value=\"$descricao| \" />";
  33.                              
  34.                 }
  35.     $xml .= "</config>";
  36.     header('Content-type: text/xml');
  37.     echo $xml;
  38.   }
  39.                                
  40. ?>
RAW Paste Data