Need help with the below. I want to call all rows concerned yet I only get one.
I have tried all possible methods to output this and all I get is one result from different sessions. The getID function calls active session user ID but results are the same for all sessions.
public function getChildId()
{
$child_id = $this->db->query("SELECT firstname, lastname
FROM " . $this->db->table("customers") . "
RIGHT JOIN " . $this->db->table("genealogy") . " on parent_id
WHERE parent_id = '". $this->customer->getID(). "'"
);
foreach ($child_id as $child => $child_id->num_rows ) {
$child = array(
$this->name = $child_id->row['firstname'],
$this->surname = $child_id->row['lastname']
);
}
return $child;
}
}
On var_dump ($child) I get: array (size=2)
0 => string 'John' (length=8)
1 => string 'Doe' (length=9)
I have 3 customer entries/rows on the database
on parent_id = ?$child[] = array(......)