File Open and Writes..
| From: | Ashwin Kutty | Date: | Fri, 17 Aug 2001 18:06:57 +0000 |
| Subject: | File Open and Writes.. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63214@lists.php.net to get a copy of this message | ||
Hi,
I have a little function in my script that used to work until a little while
back and for some reason it has decided to act up.. It is a basic function that
reads a number from a file and then processes it, but increments it by 1,
writes it back to the file and closes it.. now it used to work ok, but somehow,
suddenly..
The function looks something along the lines of..
$filename ='/path/to/my/file/filet';
$fd = fopen( $filename,"r");
$prev_ord_id = fread ($fd, filesize ($filename));
$order_id = $prev_ord_id+1;
fclose( $fd );
$ord_id = "BW" . $order_id;
$fp = fopen( $filename,"w+");
fwrite( $fp, $order_id, 26);
fclose( $fp );
The version of PHP on the server is:- 4.0.4pl1 and it sits on a RedHat Linux
7.1 server..
I know there were some questions about file related functions in one of the
versions of PHP but since this was working fine until now, I dont know..?
--
"Wise men talk because they have something to say; fools talk
because they have to say something." - Plato
Ashwin Kutty
Systems Administrator
Dalhousie University Libraries
(902) 494-2694