Tema: Php xml
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/10/2009, 05:03
milicua
 
Fecha de Ingreso: septiembre-2008
Mensajes: 11
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Php xml

Este es el code que genera el XML. No sé, llevo tiempo buscando el motivo y no lo encuentro.


<?
include("localconex.php");
$link =Conectarse();
$query=mysql_db_query("trafic_mailsender","SELECT * FROM mailsender");

while($row=mysql_fetch_array($query)){
$xml = "<?xml version=\"1.0\"?>\n";
for($x = 0 ; $x < mysql_num_rows($query) ; $x++){
$row = mysql_fetch_assoc($query);
$xml .= "\t<entry>\n";
$xml .= "\t\t<id>" . $row['id'] . "</id>\n";
$xml .= "\t\t<mail>" . $row['mail'] . "</mail>\n";
$xml .= "\t\t<nombre>" . $row['nombre'] . "</nombre>\n";
$xml .= "\t\t<apellido1>" . $row['apellido1'] . "</apellido1>\n";
$xml .= "\t\t<apellido2>" . $row['apellido2'] . "</apellido2>\n";
$xml .= "\t\t<empresa>" . $row['empresa'] . "</empresa>\n";
$xml .= "\t\t<direccion>" . $row['direccion'] . "</direccion>\n";
$xml .= "\t\t<telefono>" . $row['telefono'] . "</telefono>\n";
$xml .= "\t</entry>\n";
}

//echo $xml;
$nombre = "archivo.xml";
$open = fopen($nombre,"r+");
fwrite($open,$xml);
fclose($open);
}
mysql_close($link);
//echo "<script languaje='javascript' type='text/javascript'>window.close();</script>";

?>