Formatting information in a PHP recordset and setting it to an Array
<p>I am attempting to use a Manager Class to take the results of a query and do formatting on pieces of information so I don't have to have logic on my view. I googled a number of solution and thought this would work, but my Array of Key=>values is coming back blank. Can someone take a look at it and see what i am doing wrong? Thanks!</p>

<p>I have verified that $results contains the values I am attempting to format and place back into an Array.</p>

<pre><code>while($row = mysqli_fetch_array($results)){
    $pets[$row['petID']] = $row['petID'];
    $pets[$row['chipID']]=$row['chipID'];
    $pets[$row['adoptionDate']]=Date($row['adoptionDate'],'m-d-Y');
    $pets[$row['pType']]=$row['pType'];
    $pets[$row['breedName2']]=$row['breedName2'];
    $pets[$row['breedName1']]=$row['breedName1'];
    $pets[$row['imageName']]=$row['imageName'];
    $pets[$row['intakeDate']]= Date($row['intakeDate'],'m-d-Y');
    $pets[$row['status']]=$row['status'];
    $pets[$row['age']]=$row['age'];
    $pets[$row['ageText']]= $this-&gt;getAge($row['age']);
    $pets[$row['gender']]=$row['gender'];
    $pets[$row['genderText']] = $this-&gt;getGender($row['gender']);
    $pets[$row['breed2']]=$row['breed2'];
    $pets[$row['breed']]=$row['breed'];
    $pets[$row['petType']]=$row['petType'];
    $pets[$row['petName']]=$row['petName'];
    $pets[$row['customID']]=$row['customID'];
}
</code></pre>

<p>Here is the complete function that does not return anything:</p>

<pre><code>public function getPets($cond,$orgID){

        $pets = array();
        $pg = new petsGateway();
        $results = $pg-&gt;listByQuery($cond, $orgID);

        while($row = mysqli_fetch_array($results)){
            $pets[$row['petID']] = $row['petID'];
            $pets[$row['chipID']]=$row['chipID'];
            $pets[$row['adoptionDate']]=Date($row['adoptionDate'],'m-d-Y');
            $pets[$row['pType']]=$row['pType'];
            $pets[$row['breedName2']]=$row['breedName2'];
            $pets[$row['breedName1']]=$row['breedName1'];
            $pets[$row['imageName']]= $this-&gt;getImageURL($row['imageName']);
            $pets[$row['intakeDate']]= Date($row['intakeDate'],'m-d-Y');
            $pets[$row['status']]=$row['status'];
            $pets[$row['age']]=$row['age'];
            $pets[$row['ageText']]= $this-&gt;getAge($row['age']);
            $pets[$row['gender']]=$row['gender'];
            $pets[$row['genderText']] = $this-&gt;getGender($row['gender']);
            $pets[$row['breed2']]=$row['breed2'];
            $pets[$row['breed']]=$row['breed'];
            $pets[$row['petType']]=$row['petType'];
            $pets[$row['petName']]=$row['petName'];
            $pets[$row['customID']]=$row['customID'];
        }
        return $pets;
    }
</code></pre>
