I'm trying to write some simple code to the following, but am having some problems.
I want it too:
- Open hits.txt and extract the contents (a single integer)
- Add 1 to this value and write is back into the same hits.txt file
The following code throws up errors on the 3rd line:
$filename = "hits.txt";
$fr = fopen($filename, "r");
$contents45 = fread($fr, filesize($filename);
fclose("fr");
$fp = fopen($filename, "w");
fwrite($fp, $contents45+1);
fclose("$fp");
Cheers.