Connecting Tech Pros Worldwide Help | Site Map

fwrite

  #1  
Old July 17th, 2005, 01:15 PM
Ken
Guest
 
Posts: n/a
I have a template.php file in which the results is created with session
variables.

I want to write the actual data, not session variables, into a file called
test.tmp

I can view the actual data when template.php is displayed.

When I write the data to test.tmp, the session variables are copied, not the
results of the variables.

How do I write (save) the results of the template.php in test.tmp?

$url_read = $_SESSION['folder_dir']."template.php";
$url_write = $_SESSION['folder_dir'].'test.tmp';
$f_r = file($url_read);
$read_file = fopen($url_read, "r");
echo $read_file;

$f_w = file($url_write);
$write_file = fopen($url_write, "w");
foreach($f_r as $line) {
fwrite($f_w,$line);
}
fclose($read_file);
fclose($write_file);

Thanks.

Ken



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
fwrite() misses writing a byte hemant.gaur@gmail.com answers 12 October 11th, 2007 01:35 PM
fwrite() fails when called after fread() Richard Hsu answers 2 April 11th, 2006 10:15 PM
fwrite problems... sumit1680@rediffmail.com answers 3 January 8th, 2006 01:25 AM
about fwrite( ) FrancisC answers 23 November 13th, 2005 08:35 PM
fwrite problems ... Antoine Bloncourt answers 3 July 17th, 2005 05:22 AM