Forum Moderators: coopster

Message Too Old, No Replies

fopen( ) Help Needed

Created xml from database and need to open it.

         

bumpaw

4:40 am on Apr 17, 2005 (gmt 0)

10+ Year Member



I have a nice little script that converts a database table to an .xml file and then does fclose( ). I would like to have the new file open automatically as the script finishes rather than use a link to open result.xml in the browser. I'm trying fopen( ) with no luck.

IamStang

12:45 pm on Apr 17, 2005 (gmt 0)

10+ Year Member



I can only assume that the script you are using opens the database, reads it into some sort of result, and then does an fwrite() to create the xml file.

If that is indeed the case, you might try copying the script to a new file and removing the fwrite($xmlFileName, "$results") and substituting it with an: echo $results;

Or if you do want the actual xml created for later use, just add the echo at the end of the script.

If the above doesnt cover it, maybe reply with some sample code and a bit more info on exactly what you are trying to accomplish.

Hope it helps,
IamStang

Birdman

1:51 pm on Apr 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could use a header redirect after the script:

header("Location: ".$file_path);
?>

$file_path should be replaced with the variable used in your fopen() command. This will redirect the browser to the newly written file.

bumpaw

2:16 pm on Apr 17, 2005 (gmt 0)

10+ Year Member



Birdman I got this to work:

header("Location: query.xml");

Thanks