seadonkey Posted April 20, 2008 Share Posted April 20, 2008 This is just a front end very basic hit counter I am working on <?php class HitCounter { /* $fileName - the name of the text file that contains the current number of hits.*/ private $fileName = ""; /* This construct holds the text file that contains the number of hits*/ function __construct($file) { $this->fileName = $file; } /*reads the contents of the text file specified in $fileName and returns the value*/ public function getCounter() { $newValue = $this.getCounter(); $newValue++; } /*this will add the number to the file */ public function setCounter($counter) { file_put_contents($fileName, $counter); } /*This will get the current counter numbe rand will updated it for each new hit it gets. */ public function updateCounter() { $this->getCounter(); $this->setCounter($newValue); } } ?> When I try to run it I am getting Fatal error: Call to undefined function getcounter() in /home/academyw/public_html/rudolph/lab12/HitCounterClass.php on line 16 and was wondering if you could point me in the right direction or see what I am doing wrong. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 20, 2008 Share Posted April 20, 2008 You'll have to show us how you're using the above. Also, when you post your code, please use tags. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.