This one has me completely baffled. I'm simply trying to build an array from a result set. Pretty simple & straightforward. However, it seems only the last two elements are being stored in the array. The first however-many-other elements there are just disappear into thin air.
Here's my code snippet
Code: Select all
//This code is run in an object, so I'm accessing $this a lot
//$this->DB->execute simply executes the query & returns a mysqli result set
$result = $this->DB->execute($query,"trying to gather $type");
if($result && $this->DB->numRows($result) > 0)
{
//$row is an array - the result of calling mysqli_result::fetch_assoc()
while($row = $this->DB->getData($result))
{
//the function this code is in accepts 1 argument,type, with the value "children" or "siblings"
//that argument is used to determine which variable these values get stored in
$this->{$type}[$row['id']] = array('menu_title'=>$row['menu_title'],
'publish'=>$row['publish'],
'type'=>$row['type'],
'url'=>$row['url']);
}
}On each iteration I can print_r() the row & it's populated just fine.
I have never seen anything like this - does anyone have any idea at all?
Thanks.