The powers that be whant a page counter but the counter always returns 1 like TRUE I think because even if I put 2 in the text file, it is over written with 1. have a feeling it is to do with the array as I haven’t just got my head into how they work in php. Any suggestions would be appreciated. thanks
Code:
$fileForCounter = "indexCounter.txt";
$filePointer = fopen ($fileForCounter, "r");
if($filePointer) {
$data = file ($theFile);
$somenum = $data[theData];
$counter = $somenum[0];
$counter = $counter + 1;
fclose ($filePointer);
}else{
print "Open File Failed";
}
$fileForCounter = "indexCounter.txt";
$filePointer = fopen ($fileForCounter, "w");
if($filePointer) {
fwrite ($filePointer, $counter);
fclose ($filePointer);
}else{
print "write to File Failed";
}