Estoy tratando de escribir un archivo XML a partir de la base de datos mysql, sin embargo me da el siguiente error:
![](https://imghost.io/images/2017/07/27/Capturadepantalla2017-07-26alas19.47.07.png)
Deduzco que es porque estoy haciendo la consulta SQL mal.
El código del script es:
Código:
Base de datos:<?php header('Content-type: text/xml'); $xmlout = "<?xml version=\"1.0\" ?>\n"; $xmlout .= "<persons>\n"; $db = new PDO('mysql:host=xxx;dbname=xxxxxl','xxxx','xxx'); $stmt = $db->prepare("select * from wp_cf7dbplugin_submits"); $stmt->execute(); while($row = $stmt->fetch()){ $xmlout .= "\t<person>\n"; $xmlout .= "\t\t<rut>".$row['rut']."</rut>\n"; $xmlout .= "\t\t<nombre>".$row['nombre']."</nombre>\n"; $xmlout .= "\t\t<apellido>".$row['apellido']."</apellido>\n"; $xmlout .= "\t\t<correo>".$row['correo']."</correo>\n"; $xmlout .= "\t\t<telefonomovil>".$row['telefonomovil']."</telefonomovil>\n"; $xmlout .= "\t\t<carrera>".$row['carrera']."</carrera>\n"; $xmlout .= "\t</person>\n"; } $xmlout .= "</persons>"; echo $xmlout; ?>
![](https://imghost.io/images/2017/07/27/Capturadepantalla2017-07-26alas19.51.05.png)
Quedo atento,
Saludos