php question about array of objects?

I have created a class Vacancy which has some variables :
public $salary;
public $id;
...

I am looping through the result of a query and creating a vacancy for each match
Then I adding the vacancy to an array.

$tempVacancy=new Vacancy();
$tempVacancy->salary = mysql_result($result,$i,"salary");
$tempVacancy->id =mysql_result($result, $i, "yid");

//Then when i what to put the created vacancy in an array something happens
$vacancies[$i] = $tempvacancy; <===============Somehow this is not working because
when i try to access vacancies[$i] it is giving the following error:

Fatal error: Call to a member function printVacancy() on a non-object in C:\wamp\www\home\search.php on line 210
sorry my code just illustrates the logic of my program. That's not my actual code.
I'm afraid that's not the problem. But thanks for trying :)
OH CRAP U WERE RIGHT!! THANKS!
 
Back
Top