pugboy Posted May 1, 2008 Share Posted May 1, 2008 For some reason, the following code doesn't work. Just places a 0 in the file... <?php $ref = $_GET["rid"]; $dir = "dir/" . $ref . "/ref.txt"; if(file_exists($dir)){ $myFile = $dir; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); $theData = $theData + "X"; $fh = fopen($myFile, 'w') or die("Can't open file"); fwrite($fh, $theData); fclose($fh); } ?> The file has text already in it, and I am using it for a referral program on my site... The rid is the username, and their account is in the "dir" folder. Anyone know why? Link to comment https://forums.phpfreaks.com/topic/103788-solved-php-file-writting-probs/ Share on other sites More sharing options...
pugboy Posted May 2, 2008 Author Share Posted May 2, 2008 So I didn't find out why, but I changed the write to append. Link to comment https://forums.phpfreaks.com/topic/103788-solved-php-file-writting-probs/#findComment-531377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.