When I create the object SearchResult, I have the constructor call 'setStandardsTable' function that sets variable 'standardsTable'. For some reason I get the error
Fatal error: Uncaught Error: Call to undefined function setStandardsTable()...
and
Error: Call to undefined function setStandardsTable()...
I tried returning the value after each variable declaration but still nothing. Below is my code.
class SearchResult {
private $keyword, $standardsTable;
/*Constructor */
public function __construct($subject, $keyword) {
//selects the standards table to query based on subject selected
$this->standardsTable = setStandardsTable($subject);
//sets the keyword that will be used to search in the Standards table selected
$this->keyword = $keyword;
}
private function setStandardsTable($subj) {
$standardsSelected="";
switch($subj) {
case "General Math":
$standardsSelected = "math_standards_eng";
break;
case "Algebra I":
$standardsSelected ="algebra_standards_eng";
break;
case "Algebra II":
$standardsSelected = "algebra_two_standards_eng";
break;
default:
$standardsSelected = "math_standards_eng";
}
return $standardsSelected;
}
}