View Single Post
  #1 (permalink)  
Old October 11th, 2003, 05:11 PM
joeore joeore is offline
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem to write file...

in chapter 10 there is a example of simple counter. I made 20 pages reloading , but the counter is always 1 and not increase. What is the problem?...

This is the code:

<?php
$fp = fopen("./cacchio.dat", "r");
if (!$fp) {echo "il file non esiste";}
$contatore = (int) fread ($fp, 20);
fclose($fp);

$contatore++;

echo $contatore;

$fp = fopen("./cacchio.dat", "w");
fwrite ($fp, $contatore);
fclose($fp);
?>

Reply With Quote