Subject: could you explain me two lines in chapter 7 thanks
Posted By: migra Post Date: 10/10/2006 7:52:25 AM
within (function PopulateObjectArray)in class.GenericObjectCollection.php

$refObjArrayIndexObj = &$this->obj_array[$this_index];
i don't know what is the value of $refObjArrayIndexObj, because in this line
is the first time where $this->obj_array is used,
and i don't get the line where is asigned something to
$this->obj_array = (like this)
so i can't understand what is holding $refObjArrayIndexObj

following the code there is another line in (function RetrievePopulatedObjects)
$return_array[$counter] = $this->obj_array[$i];
and then
return($return_array);
but if $this->obj_array was never assigned with something,
the value of $return_array will be?.

Thank you, and congratulations.

complementing my question, i ask for this two lines because when i run the code
$uh= new UserHome();
$arUsers= $uh->GetallUsersWithFirstNameBeginningWith('l');
for ($i=0;i<=sizeof($arUsers)-1;$i++){
    print " " .$arUsers[$i]->GetField("last_name") . " " .
          $arUsers[$i]->GetField("first_name") . " " .
          $arUsers[$i]->GetField("username"). "<br/>\n";
};

i get the following error after i get the desired return.
john Doe
Jane Doe
Fatal error: Call to a member function GetField() on a non-object in C:\Apache2\Pruebas\ProPHP5\ch07\testuserhome.php on line 7
the error is referring to
$arUsers which is receiving the value from $return_array which implies obj_array

Go to topic 34674

Return to index page 152
Return to index page 151
Return to index page 150
Return to index page 149
Return to index page 148
Return to index page 147
Return to index page 146
Return to index page 145
Return to index page 144
Return to index page 143