newbie problem: Hit counter.

From: Date: Thu, 15 Mar 2001 16:17:14 +0000
Subject: newbie problem: Hit counter.
Groups: php.general 
Request: Send a blank email to php-general+get-44052@lists.php.net to get a copy of this message
For some reason the number of hits value is not getting replaced [after incrementing] into the original counter file. any help would be appreciated. here is the code : <?php $cntfile = "count"; // The filename where the number of hits is stored, if there isnt one then make it & put the number 0 in it $rs = fopen ($cntfile, "rw"); while (!feof($rs)) { $cntr = fgets($rs, 4096); echo "counter now is $cntr"; echo "<br>"; } fclose ($rs); $wr = fopen ($cntfile, "rw"); $cntr+=1; fputs($wr, $cntr); echo $cntr; fclose($wr); ?>

« previous php.general (#44052) next »