473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Save data not variables in a file

Ken
I am try to save the "values" of variables from a file (template.php) to
another file (tmp.txt).

$value = "12345";

template.php
<?php
The answer is $value. //When viewing the file, I see 12345.
?>

tmp.txt
The answer is 12345. This is what I am trying to do.

The answer is $value. This is the results of the following script.

When I write the data to tmp.txt, the variable is copied, not the
value of the variable.

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

<?php
$url_read = $_SESSION['folder_dir']."template.php";
$url_write = $_SESSION['folder_dir'].'tmp.txt';

$f_r = file($url_read);
$read_file = fopen($url_read, "r");

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

Thanks


Jul 17 '05 #1
1 2069
Ken wrote:
I am try to save the "values" of variables from a file (template.php)
to another file (tmp.txt).

$value = "12345";

template.php
<?php
The answer is $value. //When viewing the file, I see 12345.


tmp.txt
The answer is 12345. This is what I am trying to do.

The answer is $value. This is the results of the following script.

When I write the data to tmp.txt, the variable is copied, not the
value of the variable.

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


$url_read = $_SESSION['folder_dir']."template.php";
$url_write = $_SESSION['folder_dir'].'tmp.txt';

$value = "12345";

ob_start();
include $url_read;
$f_r = ob_get_contents();
ob_end_clean();

$write_file = fopen($url_write, "ab");
fwrite($write_file, "$f_r\n");
fclose($write_file);
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
11
by: Thomas Magma | last post by:
I have a simple JavaScript application that will generate some text type data for the end user. Is it possible to have a button that will allow them to save this information to a text file? ...
3
by: Darius | last post by:
Hello, there is an NMEAParserDemo application written in VC++ avaliable for download from http://www.visualgps.net/Papers/NMEAParser/NMEAParserDemo%20Project.zip. Source code in VC++ is...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
0
by: vorticitywolfe | last post by:
Hello, I am working with a netcdf file and trying to remove a long string from it e.g. "KAST BLAH BLAH BLAH BLAH DATA BLAH DATA BLAH BLAH BLAH BLAH BLAH DATA BLAH DATA BLAH" Right now what I...
0
by: crazyyellowguy | last post by:
hi, This is my first post in this forum and I just wanted to thank you for even taking a look at my post. The class that I am writing the C code for is my first computer class and my knowledge is...
1
by: JoshPierce | last post by:
I want to allow users of my program to click File>Save and have a save dialog open and allow them to save all of their input. here is the background of my program. I have a program that allows...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.