我想在CakePHP ctp文件中使用数组查看MySQL数据。我无法理解的代码中的错误是什么?
$this->loadModel('MacHistory');
$data = $this->MacHistory->find('all', array('conditions' => array('package_customer_id' => $pcid)));
$filteredData = array();
foreach ($data as $single) {
$mac[] = $single['MacHistory']['mac'];
$user_id[] = $single['MacHistory']['installed_by'];
$installation_date[] = $single['MacHistory']['installation_date'];
}
if (!empty($user_id)) {
$filteredData['mac'] = $mac;
$filteredData['user_id.'] = $user_id;
$filteredData['installation_date.'] = $installation_date;
$this->request->data['PackageCustomer'] = $filteredData;
}
$this->set(compact('filteredData'));