|
Posted by Shane on 07/10/05 07:11
:)
I am following a tutorial for php (hudzilla.org)
absolutely loving it
however I am having trouble with the counter example
<?php
// your content here...
$filename = 'counter.txt'; // our counter file
$fp = fopen( $filename,"r"); // open it for READING ("r")
$counter = fread($fp, filesize($filename) ); // read in value
fclose( $fp ); // close it whilst we work
++$counter; // increase the counter by one
print "$counter hits to this page"; // print out the new value
$fp = fopen( $filename,"w"); // open it for WRITING ("w")
fwrite( $fp, $counter); // write in the new value
fclose( $fp ); // close it
?>
however it dont werk :\
by dont work I mean...
it wont add to a number held in counter.txt
it _will_ read that number fine, just not change it
I am currently using
# php -v
PHP 4.3.10 (cli) (built: Apr 4 2005 04:47:06)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
and all permissions seem correct
TIA
--
Hardware, n.: The parts of a computer system that can be kicked
The best way to get the right answer on usenet is to post the wrong one.
[Back to original message]
|