Tema: php xml
Ver Mensaje Individual
  #10 (permalink)  
Antiguo 03/02/2011, 11:56
Derzz
 
Fecha de Ingreso: enero-2011
Mensajes: 112
Antigüedad: 13 años, 3 meses
Puntos: 4
pero esta igual
om como deberia ser
Código PHP:
Ver original
  1. "<song title=".$row['nombre']."path=".$row['ruta']."/>\n";

ayudenme con este codigo
Código PHP:
Ver original
  1. <?php
  2.  
  3. /*
  4. This is a sample file that extracts a list of records from a mysql database and
  5. builds a playlist from it. After looking through this file, you'll probably
  6. 'get the idea' and'll be able to connect the flash player
  7. to your own database.
  8. */
  9.  
  10.  
  11. // first connect to database
  12. $dbcnx = @mysql_connect("localhost","derzz_web","xxxxxx");
  13. $dbselect = @mysql_select_db("derzz_musik");
  14. if ((!$dbcnx) || (!$dbselect)) { echo "Can't connect to database"; }
  15.  
  16.  
  17. // next, query for a list of titles, files and links.
  18. $query = "SELECT nombre,ruta FROM archivos_mp3";
  19. $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  20.  
  21.  
  22. // third, the playlist is built in an xspf format
  23. // we'll first add an xml header and the opening tags ..
  24. header("content-type:text/xml;charset=utf-8");
  25.  
  26.  
  27. echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
  28. echo "  <songs>\n";
  29.  
  30. // .. then we loop through the mysql array ..
  31. while($row = @mysql_fetch_array($result)) {
  32.     echo "<song title="$row['nombre']" path="$row['ruta']"/>\n";
  33.    
  34. }
  35.  
  36. // .. and last we add the closing tags
  37. echo "  </songs>\n";
  38.  
  39.  
  40.  
  41. /*
  42. That's it! You can feed this playlist to the SWF by setting this as it's 'file'
  43. parameter in your HTML.
  44. */
  45.  
  46. ?>
quiero hacer la estructura de un XML UTF-8 pero me da error no se como hacerlo
nota: los dato los obtiene de la base de datos que los pone en un bucle
Código PHP:
Ver original
  1. echo "<song title="$row['nombre']" path="$row['ruta']"/>\n";
tengo que canmbiar esta parte
Código PHP:
Ver original
  1. <playlist version='1' xmlns='http://xspf.org/ns/0/'>
por esta
Código PHP:
Ver original
  1. <?xml version="1.0" encoding="UTF-8"?>

de la linea 27

Última edición por GatorV; 04/02/2011 a las 15:14