Here it is my actual code:
(let's say i call this by: bla.php?&etiq=idontknow&elem=0&valor=hello)
Code: Select all
<?php
if (file_exists('1.xml')) {
$xml = simplexml_load_file('1.xml');
} else {
exit('Error al abrir Base de Datos XML, consulte a su agente de ventas.');
}
$x = $_GET['etiq'];
$y = $_GET['elem'];
$z = $_GET['valor'];
$xml->${$etiq}[$elem] = $valor;
echo $xml->asXML();
$xml->saveXML('2.xml'); // save as file;
?>Warning: main() [function.main]: Cannot write or create unnamed element in C:\AppServ\www\try.php on line 10
Where is my error? And if you know a better way to do it... share it please!
Thanks!