View Single Post
Old 04-17-2005, 06:39 AM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,694
redhead is on a distinguished road
hmmmm.... What happens for the very first time..
Code:
$newcount = 

$file="count.txt"; 

$fh1=fopen($file,"r"); 
$count=fscanf($fh1,"%d"); 
fclose($fh1); 

$fh=fopen($file,"w+"); 
$count[0]=$count[0]+$newcount;
Assuming the count.txt is empty, and since your newcount is empty, theres nothing written to the file, on next read we have the same problem..
If your file contains a number (say 1) then on your $count[0]=$count[0]+$newcount; you have the same problem, the counter isn't incremented, since $newcount isn't holding anything..
On another note, I doubt this code will even run..
$newcount= is an undisclosed statement, which usualy causes an error.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote