我无法从两个不同的表中提取数据。我正在尝试首先获取具有给定名称的所有地址(选择tom
表中具有名称的所有地址)。然后使用地址,在另一个表(table2)中查看这些地址并从 col 中提取所有数据number
。有没有比我的代码更好的方法:
控制器:
this->table = new Address();
$getaddress = $this->table->getAddress($name); //grabbing all address associated with a given name
$address = $getaddress->toArray();
foreach ($addy as $address)
{
this->table2 = new Number();
$numbers = $this->table2->getNumber($address['numberColumn']);
$this->view->numbers = $numbers->toArray();
}