A
Anonymous
Guest
Hi
I have a small problem or big i u will...
i have a file zs.inc and the contents of
the file is just date (ex: 2.2.2003).
now here the code to open that file
and get the contents into string:
$filename = "zs.inc";
$fp = fopen ($filename, "r+");
$read_file = fread($fp, filesize ($filename));
$str_read = $read_file;
$str_date = "$date";
$str_read1 = str_replace($str_read, $str_datum, $str_read);
fputs ($fp, $str_read1);
fclose ($fp);
What's the problem? The problem is that this doesn't
replaces the contents of the file, it appends the
new date a line under the first.
here's the example:
contents of the file, before running code:
2.2.2003
after running the code:
2.2.2003
3.2.2003
I just want to replace the first date (2.2.2003)
with the current date(3.2.2003).
See my problem? Intead of replacing the first date
with the current it appends it self a line under.
How to fox this?
I also tied with fwrite but it's the same s...
help me...
thx
I have a small problem or big i u will...
i have a file zs.inc and the contents of
the file is just date (ex: 2.2.2003).
now here the code to open that file
and get the contents into string:
$filename = "zs.inc";
$fp = fopen ($filename, "r+");
$read_file = fread($fp, filesize ($filename));
$str_read = $read_file;
$str_date = "$date";
$str_read1 = str_replace($str_read, $str_datum, $str_read);
fputs ($fp, $str_read1);
fclose ($fp);
What's the problem? The problem is that this doesn't
replaces the contents of the file, it appends the
new date a line under the first.
here's the example:
contents of the file, before running code:
2.2.2003
after running the code:
2.2.2003
3.2.2003
I just want to replace the first date (2.2.2003)
with the current date(3.2.2003).
See my problem? Intead of replacing the first date
with the current it appends it self a line under.
How to fox this?
I also tied with fwrite but it's the same s...
help me...
thx