mikemay Posted March 12, 2008 Share Posted March 12, 2008 I have inherited an application and is now running on PHP5 instead of PHP4... i am getting the following fatal error -- Fatal error: Call to a member function validate() on a non-object the code is as follows: Thanks in advance if (isset($_POST['nJobs'])) { $nJobs_old = $empApp->nJobs; $empApp->nJobs = (int) $_POST['nJobs']; } if ($empApp->nJobs < $empApp->minJobs) $empApp->nJobs = $empApp->minJobs; if ($empApp->nJobs > $empApp->maxJobs) $empApp->nJobs = $empApp->maxJobs; for ($i=0; $i<$empApp->nJobs; $i++) { if (!isset($empApp->EmploymentHistory[$i])) { $empApp->EmploymentHistory[$i] = new empApp_EmploymentHistory(); //class in "application.class.php" } $this_empHist = &$empApp->EmploymentHistory[$i]; if (isset($_POST['Job_Company_'.$i])) $this_empHist->Job_Company = $_POST['Job_Company_'.$i]; if (isset($_POST['Job_Address_'.$i])) $this_empHist->Job_Address = $_POST['Job_Address_'.$i]; if (isset($_POST['Job_Phone_'.$i])) $this_empHist->Job_Phone = $_POST['Job_Phone_'.$i]; if (isset($_POST['Job_Supervisor_'.$i])) $this_empHist->Job_Supervisor = $_POST['Job_Supervisor_'.$i]; if (isset($_POST['Job_Dates_'.$i])) $this_empHist->Job_Dates = $_POST['Job_Dates_'.$i]; if (isset($_POST['Job_Position_'.$i])) $this_empHist->Job_Position = $_POST['Job_Position_'.$i]; if (isset($_POST['Job_Duties_'.$i])) $this_empHist->Job_Duties = $_POST['Job_Duties_'.$i]; if (isset($_POST['Job_Wages_'.$i])) $this_empHist->Job_Wages = $_POST['Job_Wages_'.$i]; if (isset($_POST['Job_Leave_'.$i])) $this_empHist->Job_Leave = $_POST['Job_Leave_'.$i]; if (isset($_POST['Job_CanContact_'.$i])) $this_empHist->Job_CanContact = (int) $_POST['Job_CanContact_'.$i]; $this_empHist->validate(); } if (isset($nJobs_old) && $nJobs_old > $empApp->nJobs) { for ($i=$empApp->nJobs; $i<=$nJobs_old; $i++) { if (isset($empApp->EmploymentHistory[$i])) unset($empApp->EmploymentHistory[$i]); } } Quote Link to comment Share on other sites More sharing options...
mikemay Posted March 12, 2008 Author Share Posted March 12, 2008 oh almost forgot.. this is the specific line throwing the error. $this_empHist->validate(); Quote Link to comment Share on other sites More sharing options...
trq Posted March 12, 2008 Share Posted March 12, 2008 Where is $this_empHist defined? Quote Link to comment Share on other sites More sharing options...
keeB Posted March 13, 2008 Share Posted March 13, 2008 Looks like it probablt should be.. $this->empHist->validate(); no? 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.