Hey Guys,
I’m in the process of creating a “Job Center” module for PHPvms. The idea beign that the admin can insert jobs available within the VA and have people browse and apply for them right through the website.
Its still early doors and MVC approach to PHPvms is new to me… my experience thus far has been in procedural PHP.
So far what Ive done is referenced both the built in “News” module and the “Exam Center” module availbe for download here on the forums as examples to follow.
I have created a JobsData.class.php which is handling all my calls to the database to retireve data (and eventually will input/edit and delete).
I have made jobs.php which is inside the module directory and is dealing with calling the functions from the Jobsdata.php ,
and I have two .tpl files.. one designed to just list the currently available jobs and a further one to display the job details as a user clicks on a heading from the Job List.
I think im halfway there to getting this sussed, however im getting this error:
Warning: Invalid argument supplied for foreach() in C:Usersbunoire14DesktopDevVMScorecommonJobsData.class.php on line 19
now heres my script:
public function GetJobs($count='')
{
$sql='SELECT job_ref, job_title,date_posted, posted_by FROM new_jobs ORDER BY postdate DESC
LIMIT '.$count;
$result = DB::get_results($sql);
foreach($result as $row)
{
$this->set('jobref', $row->job_ref);
$this->set('title', $row->job_title);
$this->set('postedby', $row->posted_by);
$this->set('postdate', date('d/m/Y', $row->date_posted));
}
}
}
I have read the API and it says that the DB::get_results() returns an array but it seems im not handling that array correctly, can anyone shed any light on this as I’m lost!
Cheers,