I have a php script which creates an xml file

    //Select the Database

    $result = mysql_query("select * from XMLAfdeling", $db);  

    //Create SimpleXMLElement object
    $xml = new SimpleXMLElement('<xml/>');

    //Add each column value a node of the XML object
    while($row = mysql_fetch_assoc($result)) {
        echo $row['Afdelingnaam']."\n";
        $mydata = $xml->addChild('mydata');

    //Create the XML file
    $fp = fopen("UltimoAfdeling.xml","wb");

    //Write the XML nodes

    //Close the database connection

when I run the code in my browser on my localhost it works perfectly but when I try to run it in the windows command prompt as administrator with the next command
C:\xampp\php\php.exe C:\xampp\htdocs\test\UltimoAfdelingXML.php
I can print the result to the command prompt but the script won't make the xml file.

Anny hints?

solved it, I just had to use the absolute path int fopen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.