In the code below, I'm getting the dreaded "Using $this when not in object
context" error even though I AM in the class. Why is this happening, I don't
understand it.
If I remove the $this-> from the call to DeleteOldPartInfo, I then get this error:
"Call to undefined function DeleteOldPartInfo()"
<?php
class ReportGenerator
{
public function __construct() {
parent::__construct();
} // public function __construct()
private function DeleteOldPartInfo($partno) {
// do something here
if(something) {
return false;
} else {
return true;
}
} // private function DeleteOldPartInfo($partno)
public function BuildReport($filename, $partno) {
// Getting
// Using $this when not in object context
// on the next line
if(!$this->DeleteOldPartInfo($partno)) {
//show error message
}
} //public function BuildReport($filename, $partno)
} // class ReportGenerator
?>